diff options
author | Ralf Mollik | 2018-02-23 15:53:57 +0000 |
---|---|---|
committer | Ralf Mollik | 2018-02-23 15:53:57 +0000 |
commit | 5b064e4f72358a7c137c248f85a9e1cf21d522ba (patch) | |
tree | a9980277fb11e42217aae2550c97320ed028583c | |
parent | 5e1560a260645448c39567fbf159852b4ddabeb8 (diff) | |
download | org.eclipse.osbp.xtext.table.common-5b064e4f72358a7c137c248f85a9e1cf21d522ba.tar.gz org.eclipse.osbp.xtext.table.common-5b064e4f72358a7c137c248f85a9e1cf21d522ba.tar.xz org.eclipse.osbp.xtext.table.common-5b064e4f72358a7c137c248f85a9e1cf21d522ba.zip |
catch up with development
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
22 files changed, 382 insertions, 93 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..84c0016 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +**._trace +**/target/ +**/VAADIN/ +**.log.properties +**git.properties +**/target/ +**/.metadata/ + +**/emf-gen/**/.gitignore +**/src-gen/**/.gitignore +**/git.properties +**/*.java._trace +**/*.log +**/*.log.properties + +**/bin/ +**/build/ +*.class +*.ctrl +**/Debug/ +.DS_Store +*.ear +*.war + +**/*.actionbin +**/*.blipbin +**/*.chartbin +**/*.cubebin +**/*.datatypebin +**/*.dtobin +**/*.entitybin +**/*.servicebin +**/*.tablebin +**/*.uibin +**/*.uisemanticbin +**/*.xtendbin +**/*.xtextbin + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml index 5f6f60a..650a536 100644 --- a/jenkins.build.config.xml +++ b/jenkins.build.config.xml @@ -15,11 +15,11 @@ <jenkins> <!-- DO NOT EDIT BELOW THIS LINE --> <jenkins.build.dependencies> + <jenkins.build.dependency>org.eclipse.osbp.blob</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.runtime</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.runtime.web</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.ui.api</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.utils</jenkins.build.dependency> - <jenkins.build.dependency>org.eclipse.osbp.utils.blob</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.utils.themes.ui</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.utils.ui</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.xtext.datamart.common</jenkins.build.dependency> diff --git a/org.eclipse.osbp.xtext.table.common.feature/.project b/org.eclipse.osbp.xtext.table.common.feature/.project index 9f80629..f04d1c4 100644 --- a/org.eclipse.osbp.xtext.table.common.feature/.project +++ b/org.eclipse.osbp.xtext.table.common.feature/.project @@ -16,12 +16,12 @@ </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> + <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> + <name>org.eclipse.m2e.core.maven2Builder</name> <arguments> </arguments> </buildCommand> diff --git a/org.eclipse.osbp.xtext.table.common.feature/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.xtext.table.common.feature/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common.feature/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/org.eclipse.osbp.xtext.table.common.feature/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.xtext.table.common.feature/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common.feature/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/org.eclipse.osbp.xtext.table.common.feature/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.xtext.table.common.feature/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..19e3115 --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common.feature/.settings/org.eclipse.xtend.core.Xtend.prefs @@ -0,0 +1,11 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true diff --git a/org.eclipse.osbp.xtext.table.common.feature/feature.xml b/org.eclipse.osbp.xtext.table.common.feature/feature.xml index 0a94d8a..b0f2def 100644 --- a/org.eclipse.osbp.xtext.table.common.feature/feature.xml +++ b/org.eclipse.osbp.xtext.table.common.feature/feature.xml @@ -14,7 +14,8 @@ id="org.eclipse.osbp.xtext.table.common.feature" label="%featureName" version="0.9.0.qualifier" - provider-name="%providerName"> + provider-name="%providerName" + plugin="org.eclipse.osbp.xtext.table.common"> <description> %description diff --git a/org.eclipse.osbp.xtext.table.common/.classpath b/org.eclipse.osbp.xtext.table.common/.classpath new file mode 100644 index 0000000..43b9862 --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/org.eclipse.osbp.xtext.table.common/.settings/com.vaadin.integration.eclipse.prefs b/org.eclipse.osbp.xtext.table.common/.settings/com.vaadin.integration.eclipse.prefs new file mode 100644 index 0000000..0904e44 --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common/.settings/com.vaadin.integration.eclipse.prefs @@ -0,0 +1,2 @@ +com.vaadin.integration.eclipse.mavenLatestVersionsUpgrade=["7.7.7"] +eclipse.preferences.version=1 diff --git a/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.core.resources.prefs b/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0c68a61 --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.m2e.core.prefs b/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.xtend.core.Xtend.prefs new file mode 100644 index 0000000..0b6859d --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common/.settings/org.eclipse.xtend.core.Xtend.prefs @@ -0,0 +1,10 @@ +//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend +BuilderConfiguration.is_project_specific=true +eclipse.preferences.version=1 +is_project_specific=true +outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true +outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false +outlet.DEFAULT_OUTPUT.sourceFolder.emf-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.directory=xtend-gen +outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true diff --git a/org.eclipse.osbp.xtext.table.common/META-INF/MANIFEST.MF b/org.eclipse.osbp.xtext.table.common/META-INF/MANIFEST.MF index 12b76a6..714e76e 100644 --- a/org.eclipse.osbp.xtext.table.common/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.xtext.table.common/META-INF/MANIFEST.MF @@ -7,29 +7,31 @@ Bundle-Activator: org.eclipse.osbp.xtext.table.common.Activator Require-Bundle: org.eclipse.core.runtime, org.eclipse.e4.ui.model.workbench;bundle-version="1.1.0", org.eclipse.e4.ui.workbench, - com.vaadin.client;bundle-version="[7.5.7,7.7.0)", - com.vaadin.server;bundle-version="[7.5.7,7.7.0)", - com.vaadin.shared;bundle-version="[7.5.7,7.7.0)", - org.eclipse.core.databinding;bundle-version="1.4.2", - org.eclipse.core.databinding.beans;bundle-version="1.2.200", + com.vaadin.client;bundle-version="[7.7.6,7.8.0)", + com.vaadin.server;bundle-version="[7.7.6,7.8.0)", + com.vaadin.shared;bundle-version="[7.7.6,7.8.0)", + org.eclipse.core.databinding;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding.beans;bundle-version="[1.3.100,1.4.0)", org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.utils;bundle-version="[0.9.0,0.10.0)", org.eclipse.osbp.gitinfo;bundle-version="[0.9.0,0.10.0)", org.jsoup;bundle-version="1.7.2", - filteringtable.osgi;bundle-version="0.9.13" + filteringtable.osgi;bundle-version="0.9.13", + org.eclipse.osbp.runtime.web.vaadin.common, + org.eclipse.osbp.blob;bundle-version="0.9.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: mondrian.olap, org.eclipse.osbp.runtime.common.i18n;version="0.9.0", + org.eclipse.osbp.ui.api.customfields;version="0.9.0", org.eclipse.osbp.ui.api.datamart;version="0.9.0", org.eclipse.osbp.ui.api.metadata;version="0.9.0", org.eclipse.osbp.ui.api.themes;version="0.9.0", - org.eclipse.osbp.utils.blob.component;version="0.9.0", org.eclipse.osbp.utils.constants;version="0.9.0", org.eclipse.osbp.utils.themes.ui;version="0.9.0", org.eclipse.osbp.utils.vaadin;version="0.9.0", org.eclipse.osbp.xtext.datamart.common.olap;version="0.9.0", org.eclipse.osbp.xtext.i18n;version="0.9.0", - org.slf4j;resolution:=optional + org.slf4j Export-Package: org.eclipse.osbp.xtext.table.common;version="0.9.0" Bundle-Vendor: Eclipse OSBP diff --git a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/BeanFilterTable.java b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/BeanFilterTable.java new file mode 100644 index 0000000..dfeaea7 --- /dev/null +++ b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/BeanFilterTable.java @@ -0,0 +1,198 @@ +package org.eclipse.osbp.xtext.table.common; + +import java.util.Timer; +import java.util.TimerTask; + +import org.eclipse.osbp.runtime.common.i18n.I18nUtil; +import org.eclipse.osbp.runtime.web.vaadin.common.data.DeepResolvingBeanItemContainer; +import org.eclipse.osbp.runtime.web.vaadin.common.data.IBeanToUniqueHashIdProvider; +import org.tepi.filtertable.FilterTable; + +import com.vaadin.data.Container; +import com.vaadin.data.Property; +import com.vaadin.data.util.converter.Converter; +import com.vaadin.data.util.converter.ConverterUtil; +import com.vaadin.server.ErrorMessage; +import com.vaadin.server.Resource; +import com.vaadin.server.ThemeResource; + +public class BeanFilterTable extends FilterTable { + + /** The item icon property id. */ + private transient Object itemIconPropertyId; + private String itemIdHash; + private boolean updateMode; + + private transient Timer sortTimer; + private boolean isSorting; + + public BeanFilterTable() { + addValueChangeListener(e -> { + if (getContainerDataSource() instanceof IBeanToUniqueHashIdProvider) { + IBeanToUniqueHashIdProvider<Object> hashIdProvider = (IBeanToUniqueHashIdProvider<Object>) getContainerDataSource(); + Object selection = e.getProperty().getValue(); + this.itemIdHash = hashIdProvider.getUniqueHashId(selection); + } + }); + addItemSetChangeListener(e -> { + if (isSorting || getSortContainerPropertyId() == null || getUI() == null) { + return; + } + if (sortTimer != null) { + sortTimer.cancel(); + } + sortTimer = new Timer(); + sortTimer.schedule(new TimerTask() { + @Override + public void run() { + try{ + isSorting = true; + getUI().accessSynchronously(() -> sort()); + }finally{ + isSorting = false; + } + } + }, 125); + }); + } + + /* + * (non-Javadoc) + * + * @see + * com.vaadin.ui.AbstractSelect#setItemIconPropertyId(java.lang.Object) + */ + @Override + public void setItemIconPropertyId(Object propertyId) throws IllegalArgumentException { + if (propertyId == null) { + super.setItemIconPropertyId(propertyId); + } else if (!getContainerPropertyIds().contains(propertyId)) { + // super.setItemIconPropertyId(propertyId); + } else if (String.class.isAssignableFrom(getType(propertyId))) { + itemIconPropertyId = propertyId; + } else { + super.setItemIconPropertyId(propertyId); + } + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.AbstractSelect#getItemIconPropertyId() + */ + public Object getItemIconPropertyId() { + return itemIconPropertyId != null ? itemIconPropertyId : super.getItemIconPropertyId(); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.AbstractSelect#getItemIcon(java.lang.Object) + */ + public Resource getItemIcon(Object itemId) { + if (itemIconPropertyId == null) { + return super.getItemIcon(itemId); + } else { + final Property<?> ip = getContainerProperty(itemId, getItemIconPropertyId()); + if (ip == null) { + return null; + } + final Object icon = ip.getValue(); + if (icon instanceof String) { + return new ThemeResource((String) icon); + } + } + return null; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.Table#formatPropertyValue(java.lang.Object, + * java.lang.Object, com.vaadin.data.Property) + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected String formatPropertyValue(Object rowId, Object colId, Property<?> property) { + if (property == null) { + return ""; + } + Converter<String, Object> converter = null; + + if (hasConverter(colId)) { + converter = getConverter(colId); + } else { + converter = (Converter) ConverterUtil.getConverter(String.class, property.getType(), getSession()); + } + Object value = property.getValue(); + if (converter != null) { + return converter.convertToPresentation(value, String.class, getLocale()); + } +// else { +// if (value instanceof Enum<?>) { +// return I18nUtil.translateEnum(getI18nService(), value, getLocale()); +// } else if (value instanceof Boolean) { +// return I18nUtil.translateBoolean(getI18nService(), (Boolean) value, getLocale()); +// } else if (value instanceof Number) { +// return I18nUtil.translateNumber(getI18nService(), (Number) value, getLocale()); +// } +// } + return (null != value) ? value.toString() : ""; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.AbstractField#getErrorMessage() + */ +// @Override +// public ErrorMessage getErrorMessage() { +// if (isDisposed()) { +// // after disposal, Vaadin will call this method once. +// return null; +// } +// +// ErrorMessage message = super.getErrorMessage(); +// reportValidationError(message); +// return message; +// } + + /* + * (non-Javadoc) + * + * @see com.vaadin.ui.AbstractField#focus() + */ + @Override + public void focus() { + super.focus(); + + setValue(getCurrentPageFirstItemId()); + } + + @SuppressWarnings("unchecked") + @Override + public void setContainerDataSource(Container newDataSource) { + super.setContainerDataSource(newDataSource); + + if (getContainerDataSource() instanceof DeepResolvingBeanItemContainer) { + @SuppressWarnings("rawtypes") + final DeepResolvingBeanItemContainer ds = (DeepResolvingBeanItemContainer) getContainerDataSource(); + ds.addItemSetChangeListener(e -> { + + // lazy update the table selection + if (!updateMode && itemIdHash != null) { + updateMode = true; + final String targetItemIdHash = itemIdHash; + getUI().accessSynchronously(() -> { + for (Object itemId : e.getContainer().getItemIds()) { + if (targetItemIdHash.equals(ds.getUniqueHashId(itemId))) { + this.setValue(itemId); + break; + } + } + updateMode = false; + }); + } + }); + } + } +} diff --git a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CellSetFilterTable.java b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CellSetFilterTable.java index c55229f..7054bcb 100644 --- a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CellSetFilterTable.java +++ b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CellSetFilterTable.java @@ -42,5 +42,4 @@ public class CellSetFilterTable extends FilterTable { super.setLocale(locale); resetFilters(); } - } diff --git a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CellSetIndexedContainer.java b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CellSetIndexedContainer.java index f275fd7..ac0a468 100644 --- a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CellSetIndexedContainer.java +++ b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CellSetIndexedContainer.java @@ -23,15 +23,16 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import org.eclipse.osbp.ui.api.datamart.DerivedOlapException; +import org.eclipse.osbp.blob.component.BlobUploadComponent; +import org.eclipse.osbp.ui.api.customfields.IBlobService; import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService; import org.eclipse.osbp.ui.api.themes.IThemeResourceService; -import org.eclipse.osbp.utils.blob.component.BlobUploadComponent; import org.eclipse.osbp.utils.vaadin.CellSetImage; import org.eclipse.osbp.utils.vaadin.PropertyLookup; import org.eclipse.osbp.xtext.datamart.common.olap.DerivedAxis; import org.eclipse.osbp.xtext.datamart.common.olap.DerivedCell; import org.eclipse.osbp.xtext.datamart.common.olap.DerivedCellSet; +import org.eclipse.osbp.xtext.datamart.common.olap.DerivedLevel; import org.eclipse.osbp.xtext.datamart.common.olap.DerivedMember; import org.eclipse.osbp.xtext.datamart.common.olap.DerivedPosition; import org.slf4j.Logger; @@ -39,6 +40,7 @@ import org.slf4j.LoggerFactory; import org.tepi.filtertable.FilterTable; import org.tepi.filtertable.paged.PagedFilterTable; +import com.vaadin.data.Property; import com.vaadin.data.Property.ReadOnlyException; import com.vaadin.data.util.IndexedContainer; import com.vaadin.ui.AbstractSelect; @@ -62,13 +64,14 @@ public class CellSetIndexedContainer extends IndexedContainer { private boolean isCrossTab = false; private Locale locale; + private IBlobService blobService; - public CellSetIndexedContainer(IDSLMetadataService dslMetadataService, Locale locale, IThemeResourceService themeResourceService, - Map<String, PropertyLookup> propertyLookupMap, final DerivedCellSet cellSet, List<Integer> coordinateSystem, boolean isCrossTab) throws ReadOnlyException, - DerivedOlapException { + public CellSetIndexedContainer(IDSLMetadataService dslMetadataService, Locale locale, IThemeResourceService themeResourceService, IBlobService blobService, + Map<String, PropertyLookup> propertyLookupMap, final DerivedCellSet cellSet, List<Integer> coordinateSystem, boolean isCrossTab) throws ReadOnlyException { super(); this.themeResourceService = themeResourceService; this.dslMetadataService = dslMetadataService; + this.blobService = blobService; this.cellSet = cellSet; this.coordinateSystem = coordinateSystem; this.isCrossTab = isCrossTab; @@ -167,7 +170,7 @@ public class CellSetIndexedContainer extends IndexedContainer { // resolve all columns properties tmpColname = "?"; if (isHeader) { - tmpColname += "ROWS"; + tmpColname += "ROWS"; } else { tmpColname += "COLUMNS"; } @@ -179,7 +182,7 @@ public class CellSetIndexedContainer extends IndexedContainer { lookup = findColumnProperty(column); // add default styles if not found if (lookup == null) { - lookup = new PropertyLookup(themeResourceService, dslMetadataService, locale); + lookup = new PropertyLookup(themeResourceService, dslMetadataService, blobService, locale); addPropertyLookup(column.toUppercaseString(), lookup); } Class<?> type = String.class; @@ -219,11 +222,11 @@ public class CellSetIndexedContainer extends IndexedContainer { return null; } - public Object getOrdinalCellValue(Integer rowOrdinal, String columnName) throws DerivedOlapException { + public Object getOrdinalCellValue(Integer rowOrdinal, String columnName) { return getCellValue(cellSet.getAxes().get(DerivedAxis.AXIS_ROWS).getPositionByOrdinal(rowOrdinal), findColumn(columnName)); } - public Object getCellValue(DerivedPosition row, DerivedPosition column) throws DerivedOlapException { + public Object getCellValue(DerivedPosition row, DerivedPosition column) { if (row == null || column == null || row.getOrdinal() == -1 || column.getOrdinal() == -1) { return null; } @@ -277,7 +280,7 @@ public class CellSetIndexedContainer extends IndexedContainer { if (((Timestamp) newValue).compareTo((Timestamp) oldValue) != 0) return true; } - return false; + return !newValue.equals(oldValue); } private void createRow(DerivedPosition row) { @@ -299,10 +302,7 @@ public class CellSetIndexedContainer extends IndexedContainer { coordinates.set(DerivedAxis.AXIS_ROWS, row.getOrdinal()); coordinates.set(DerivedAxis.AXIS_COLUMNS, column.getOrdinal()); Object value = null; - try { - value = cellSet.getCell(coordinates).getValue(); - } catch (DerivedOlapException e) { - } // NOSONAR - exception is not of interest + value = cellSet.getCell(coordinates).getValue(); if (value != null) { if (getContainerProperty(row.getOrdinal(), column.getOrdinal()) == null) { addCellSetContainerProperty(column, value, null, false); @@ -344,13 +344,9 @@ public class CellSetIndexedContainer extends IndexedContainer { } coordinatesForBoth.set(DerivedAxis.AXIS_ROWS, newRow.getOrdinal()); if (rowFound) { - try { - if (!cellSet.idsMatch(newCellSet, coordinatesForBoth, newRow.getOrdinal())) { - log.debug("primary keys do not match - full refresh"); - return false; - } - } catch (DerivedOlapException e1) { // NOSONAR - log.error(e1.getLocalizedMessage()); + if (!cellSet.idsMatch(newCellSet, coordinatesForBoth, newRow.getOrdinal())) { + log.debug("primary keys do not match - full refresh"); + return false; } } if ((newRow != null) && (oldRow != null)) { @@ -390,13 +386,13 @@ public class CellSetIndexedContainer extends IndexedContainer { Object oldValue = null; try { newValue = newCellSet.getCell(coordinatesForBoth).getValue(); - } catch (DerivedOlapException | NullPointerException e1) { // NOSONAR - log.error(e1.getLocalizedMessage()); + } catch (NullPointerException e1) { // NOSONAR + log.error("{}", e1); } if (rowFound) { try { oldValue = cellSet.getCell(coordinatesForBoth).getValue(); - } catch (DerivedOlapException | NullPointerException e) { // NOSONAR + } catch (NullPointerException e) { // NOSONAR valueFound = false; } } else { @@ -471,6 +467,9 @@ public class CellSetIndexedContainer extends IndexedContainer { case PropertyLookup.NUMBER: table.setConverter(column.getOrdinal(), lookup.getNumberConverter()); break; + case PropertyLookup.INTEGER: + table.setConverter(column.getOrdinal(), lookup.getIntegerConverter()); + break; case PropertyLookup.BIGDECIMAL: table.setConverter(column.getOrdinal(), lookup.getBigDecimalConverter()); break; @@ -524,6 +523,10 @@ public class CellSetIndexedContainer extends IndexedContainer { if (lookup == null) return null; + if(lookup.isBlob()) { + Property<?> prop = container.getContainerProperty(itemId, propertyId); + boolean ro = prop.isReadOnly(); + } String defaultStyle = lookup.getDefaultStyle(); List<Integer> coordinates = new ArrayList<>(getCoordinateSystem()); if (column.getOrdinal() >= 0 && row.getOrdinal() >= 0) { @@ -544,8 +547,8 @@ public class CellSetIndexedContainer extends IndexedContainer { return style + " " + defaultStyle; } } - } catch (DerivedOlapException | NullPointerException e) { // NOSONAR - log.error(e.getLocalizedMessage()); + } catch (NullPointerException e) { // NOSONAR + log.error("{}", e); } } // for odd rows use the darker -odd style as background-color @@ -593,8 +596,8 @@ public class CellSetIndexedContainer extends IndexedContainer { if (value != null) { return lookup.getValueTooltip(value); } - } catch (DerivedOlapException | NullPointerException e) { // NOSONAR - log.error(e.getLocalizedMessage()); + } catch (NullPointerException e) { // NOSONAR + log.error("{}", e); } } else if (column.getOrdinal() < 0 && row.getOrdinal() >= 0) { Object value = null; @@ -603,8 +606,8 @@ public class CellSetIndexedContainer extends IndexedContainer { if (value != null) { // NOSONAR return lookup.getValueTooltip(value); } - } catch (DerivedOlapException | NullPointerException e) { // NOSONAR - log.error(e.getLocalizedMessage()); + } catch (NullPointerException e) { // NOSONAR + log.error("{}", e); } } else { return row.toUnformattedString(); @@ -639,6 +642,18 @@ public class CellSetIndexedContainer extends IndexedContainer { return value; } + public Object getValueByProperty(int itemId, String columnName) { + String title = getCellTitle(itemId, columnName); + if (title != null) { + return title; + } + DerivedCell cell = getCell(itemId, columnName, null); + if (cell != null) { + return cell.getValue(); + } + return null; + } + public long getTaskId(int itemId) { DerivedCell cell = getCell(itemId, "taskid", null); if (cell != null) { @@ -680,17 +695,22 @@ public class CellSetIndexedContainer extends IndexedContainer { coordinate.set(DerivedAxis.AXIS_ROWS, rows.getOrdinal()); for (DerivedMember member : rows.getMembers()) { String[] tokens = member.getUniqueName().split("\\]\\.\\["); - for (int token = 0; token < tokens.length; token++) { - String colName = tokens[token].replace("]", "").replace("[", "").toLowerCase(); - if (columnName != null) { - if (colName.equals(columnName)) { - return tokens[token + 1].replace("]", "").replace("[", ""); + if(columnName != null) { + int idx = 1; // index 0 is the main hierarchy name + for(DerivedLevel level : member.getHierarchy().getLevels()) { + if(level.getName().equals(columnName)) { + return tokens[idx].replace("]", "").replace("[", ""); } - } else if (token > 0) { // full title without the first hierarchy as it is redundant - if (fullTitle.length() > 0) { - fullTitle += " "; + idx ++; + } + } else { + for (int token = 0; token < tokens.length; token++) { + if (token > 0) { // full title without the first hierarchy as it is redundant + if (fullTitle.length() > 0) { + fullTitle += " "; + } + fullTitle += tokens[token].replace("]", "").replace("[", ""); } - fullTitle += tokens[token].replace("]", "").replace("[", ""); } } } @@ -711,12 +731,7 @@ public class CellSetIndexedContainer extends IndexedContainer { if (ordinal != null) { if (columns.getOrdinal() == ordinal) { coordinate.set(DerivedAxis.AXIS_COLUMNS, columns.getOrdinal()); - try { - return cellSet.getCell(coordinate); - } catch (DerivedOlapException e) { // NOSONAR - log.error(e.getLocalizedMessage()); - } - break; + return cellSet.getCell(coordinate); } } else { for (DerivedMember colmember : columns.getMembers()) { @@ -725,8 +740,8 @@ public class CellSetIndexedContainer extends IndexedContainer { coordinate.set(DerivedAxis.AXIS_COLUMNS, columns.getOrdinal()); try { return cellSet.getCell(coordinate); - } catch (DerivedOlapException | NullPointerException e) { // NOSONAR - log.error(e.getLocalizedMessage()); + } catch (NullPointerException e) { // NOSONAR + log.error("{}", e); } } } @@ -756,34 +771,6 @@ public class CellSetIndexedContainer extends IndexedContainer { } - public void registerSelection(Map<String, Object> map, Object itemId) { - if (itemId == null) { - // reset selectedValues - for (int positionId : positionMap.keySet()) { - PositionInfo pos = positionMap.get(positionId); - pos.setSelectedValue(null); - } - return; - } - if (itemId instanceof Integer) { - for (int positionId : positionMap.keySet()) { - PositionInfo pos = positionMap.get(positionId); - String value = getCellTitle((int) itemId, pos.getPosition().toUnformattedString()); - if (value != null) { - pos.setSelectedValue(value); - } else { - DerivedCell cell = getCell((int) itemId, null, positionId); - if (cell != null) { - pos.setSelectedValue(cell.getValue()); - } else { - pos.setSelectedValue(null); - } - } - } - } - map.put("tablePositionInfo", positionMap); - } - public Locale getLocale() { return locale; } @@ -795,4 +782,4 @@ public class CellSetIndexedContainer extends IndexedContainer { } this.fireContainerPropertySetChange(); } -} +}
\ No newline at end of file diff --git a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CheckboxSelectionCellSetFilterTable.java b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CheckboxSelectionCellSetFilterTable.java index ed6429d..da92306 100644 --- a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CheckboxSelectionCellSetFilterTable.java +++ b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/CheckboxSelectionCellSetFilterTable.java @@ -85,7 +85,6 @@ public class CheckboxSelectionCellSetFilterTable extends CellSetFilterTable { addGeneratedColumn(CHECKBOX_COLUMN_ID, new ColumnGenerator() { private static final long serialVersionUID = -1241374338743135797L; - @Override public Object generateCell(final CustomTable source, final Object itemId, Object columnId) { final boolean selected = isItemIdSelected(source, itemId); @@ -108,9 +107,9 @@ public class CheckboxSelectionCellSetFilterTable extends CellSetFilterTable { } } }); + itemIdToCheckbox.put(itemId, checkBox); if (selected) { source.select(itemId); - itemIdToCheckbox.put(itemId, checkBox); } // Let's keep track of the checkboxes diff --git a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/PositionInfo.java b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/PositionInfo.java index b5ff30d..2ddc8a9 100644 --- a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/PositionInfo.java +++ b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/PositionInfo.java @@ -14,7 +14,7 @@ package org.eclipse.osbp.xtext.table.common; import org.eclipse.osbp.xtext.datamart.common.olap.DerivedPosition; - +import org.eclipse.osbp.ui.api.datamart.IDataMart; import org.eclipse.osbp.utils.vaadin.CellSetImage; public class PositionInfo { @@ -58,5 +58,14 @@ public class PositionInfo { } } } + + public boolean isPrimaryKey() { + if(position != null) { + if(position.toUnformattedString().startsWith(IDataMart.DATAMART_ID_COLUMN_PREFIX) && position.toUnformattedString().endsWith(IDataMart.DATAMART_ID_COLUMN_POSTFIX)) { + return true; + } + } + return false; + } } diff --git a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/TableFilterDecorator.java b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/TableFilterDecorator.java index bd81d4c..014a6d2 100644 --- a/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/TableFilterDecorator.java +++ b/org.eclipse.osbp.xtext.table.common/src/org/eclipse/osbp/xtext/table/common/TableFilterDecorator.java @@ -45,8 +45,9 @@ public class TableFilterDecorator implements FilterDecorator, Serializable { private NumberFilterPopupConfig conf = new NumberFilterPopupConfig(); private IDSLMetadataService dslMetadataService; - public TableFilterDecorator(IDSLMetadataService dslMetadataService) { + public TableFilterDecorator(IDSLMetadataService dslMetadataService, Locale locale) { this.dslMetadataService = dslMetadataService; + this.locale = locale; } public void setTextChangeTimeout(int textChangeTimeout) { |