Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2015-06-11 09:15:04 +0000
committerVincent Lorenzo2015-06-11 09:18:41 +0000
commit5ca09ba1b9108a2377a4321637ec550cc1af5fb8 (patch)
treebe322a22a18c228ff7ccbbefe56c910e6ee909f2
parenta5a78ac95a9d97b7790370fa763ec303f1f5ec00 (diff)
downloadorg.eclipse.papyrus-5ca09ba1b9108a2377a4321637ec550cc1af5fb8.tar.gz
org.eclipse.papyrus-5ca09ba1b9108a2377a4321637ec550cc1af5fb8.tar.xz
org.eclipse.papyrus-5ca09ba1b9108a2377a4321637ec550cc1af5fb8.zip
bug 469284: [Tree Table] empty table when a table is loaded with applied filters https://bugs.eclipse.org/bugs/show_bug.cgi?id=469284
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/IFilterConfiguration.java7
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java11
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java21
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java39
4 files changed, 69 insertions, 9 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/IFilterConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/IFilterConfiguration.java
index 3b77b2ad558..24dd724bbcb 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/IFilterConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/filter/configuration/IFilterConfiguration.java
@@ -19,6 +19,7 @@ import org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfigur
import org.eclipse.papyrus.infra.nattable.filter.IFilterValueToMatchManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StringValueStyle;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.Style;
+import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
/**
@@ -33,13 +34,13 @@ public interface IFilterConfiguration extends IPapyrusNatTableConfiguration {
* key used to save a filter configuration id state when the system use the default filter provided by the configuration
* It is only used as name for a {@link StringValueStyle}
*/
- public static final String FILTER_SYSTEM_ID = "filterId"; //$NON-NLS-1$
+ public static final String FILTER_SYSTEM_ID = NamedStyleConstants.FILTER_SYSTEM_ID;
/**
* key used to save filter state (the value typed by the user to filter the rows)
* This key used as name for a {@link Style} without more precision
*/
- public static final String FILTER_VALUE_TO_MATCH = "filterValueToMatch"; //$NON-NLS-1$
+ public static final String FILTER_VALUE_TO_MATCH = NamedStyleConstants.FILTER_VALUE_TO_MATCH;
/**
* key used to save a filter configuration id state when the system use a filter choosen by the user
@@ -47,7 +48,7 @@ public interface IFilterConfiguration extends IPapyrusNatTableConfiguration {
*
*
*/
- public static final String FILTER_FORCED_BY_USER_ID = "filterForcedByUserId"; //$NON-NLS-1$
+ public static final String FILTER_FORCED_BY_USER_ID = NamedStyleConstants.FILTER_VALUE_TO_MATCH;
/**
* the config attribute used to register the class loading and storing filter state
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
index ae1a1f548f8..9e757d86744 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
@@ -14,6 +14,7 @@
package org.eclipse.papyrus.infra.nattable.manager.table;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.commands.Command;
@@ -51,7 +52,6 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.Ab
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.DisplayStyle;
import org.eclipse.papyrus.infra.nattable.selection.ISelectionExtractor;
import org.eclipse.papyrus.infra.nattable.selection.ObjectsSelectionExtractor;
-import org.eclipse.papyrus.infra.nattable.sort.ColumnSortModel;
import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum;
import org.eclipse.papyrus.infra.nattable.tree.DatumExpansionModel;
import org.eclipse.papyrus.infra.nattable.tree.DatumTreeFormat;
@@ -167,6 +167,13 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
if (null != getTableEditingDomain()) {
getTableEditingDomain().addResourceSetListener(this.hideShowCategoriesListener);
}
+
+ // FIX for the bug 469284: [Tree Table] empty table when a table is loaded with applied filters
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=469284
+ if (StyleUtils.hasAppliedFilter(this)) {
+ doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null);
+ }
+
return nattable;
}
@@ -180,7 +187,7 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
natTable.addConfiguration(new TreeTableClickSortConfiguration());
}
-
+
/**
* @see org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager#updateToggleActionState()
*
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java
index 1738281c314..e9d6459b90b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NamedStyleConstants.java
@@ -14,6 +14,8 @@
package org.eclipse.papyrus.infra.nattable.utils;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StringValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.Style;
public class NamedStyleConstants {
@@ -63,5 +65,24 @@ public class NamedStyleConstants {
public static final String HIDDEN_CATEGORY_FOR_DEPTH = "hiddenCategoriesByDepth"; //$NON-NLS-1$
+ /**
+ * key used to save a filter configuration id state when the system use the default filter provided by the configuration
+ * It is only used as name for a {@link StringValueStyle}
+ */
+ public static final String FILTER_SYSTEM_ID = "filterId"; //$NON-NLS-1$
+
+ /**
+ * key used to save filter state (the value typed by the user to filter the rows)
+ * This key used as name for a {@link Style} without more precision
+ */
+ public static final String FILTER_VALUE_TO_MATCH = "filterValueToMatch"; //$NON-NLS-1$
+
+ /**
+ * key used to save a filter configuration id state when the system use a filter choosen by the user
+ * It is only used as name for a {@link StringValueStyle}, we use a specific key in order to not destroyed it when we unapply filter on a column where filter has been definied by the user
+ *
+ *
+ */
+ public static final String FILTER_FORCED_BY_USER_ID = "filterForcedByUserId"; //$NON-NLS-1$
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java
index 21e1e15796e..21ab7c2ef1d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/StyleUtils.java
@@ -16,10 +16,16 @@ package org.eclipse.papyrus.infra.nattable.utils;
import java.util.Collections;
import java.util.List;
+import javax.swing.text.StyledDocument;
+
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.IntListValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NamedStyle;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.NattablestylePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StringValueStyle;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.Style;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablestyle.StyledElement;
/**
* @author VL222926
@@ -32,7 +38,7 @@ public class StyleUtils {
* @param table
* a table
* @return
- * a list with the hidden depth in the table. The returned values in never <code>null</code>;
+ * a list with the hidden depth in the table. The returned values in never <code>null</code>;
*/
public static final List<Integer> getHiddenDepths(final Table table) {
IntListValueStyle style = getHiddenDepthsValueStyle(table);
@@ -47,7 +53,7 @@ public class StyleUtils {
* @param table
* a table
* @return
- * a list with the hidden depth in the table. The returned values in never <code>null</code>;
+ * a list with the hidden depth in the table. The returned values in never <code>null</code>;
*/
public static final List<Integer> getHiddenDepths(final INattableModelManager manager) {
return getHiddenDepths(manager.getTable());
@@ -58,7 +64,7 @@ public class StyleUtils {
* @param manager
* the table
* @return
- * the style referencing the hidden category
+ * the style referencing the hidden category
*/
public static final IntListValueStyle getHiddenDepthsValueStyle(final Table table) {
@@ -70,7 +76,7 @@ public class StyleUtils {
* @param manager
* the table manager
* @return
- * the style referencing the hidden category
+ * the style referencing the hidden category
*/
public static final IntListValueStyle getHiddenDepthsValueStyle(final INattableModelManager manager) {
return getHiddenDepthsValueStyle(manager.getTable());
@@ -105,4 +111,29 @@ public class StyleUtils {
}
return false;
}
+
+ /**
+ *
+ * @param manager
+ * the table manager
+ * @return
+ * <code>true</code> if at least one filter is register on the currents columns
+ */
+ public static final boolean hasAppliedFilter(final INattableModelManager manager) {
+ for (Object current : manager.getColumnElementsList()) {
+ if (current instanceof StyledElement) {
+ StyledElement element = (StyledElement) current;
+ NamedStyle style = element.getNamedStyle(NattablestylePackage.eINSTANCE.getStringValueStyle(), NamedStyleConstants.FILTER_SYSTEM_ID);
+ if (style != null) {
+ return true;
+ }
+ style = element.getNamedStyle(NattablestylePackage.eINSTANCE.getStringValueStyle(), NamedStyleConstants.FILTER_FORCED_BY_USER_ID);
+ if (style != null) {
+ return true;
+ }
+
+ }
+ }
+ return false;
+ }
}

Back to the top