Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2013-08-08 16:18:51 +0000
committerCamille Letavernier2013-08-08 16:18:51 +0000
commit97aac38470f7ab344bf31301181b861d8699f7cc (patch)
tree95c64443b6b90f5d43ee2d732c6e7ad69c3a8234
parent0342075e39122b9f8ac84d3cc8ff224228786af9 (diff)
downloadorg.eclipse.papyrus-97aac38470f7ab344bf31301181b861d8699f7cc.tar.gz
org.eclipse.papyrus-97aac38470f7ab344bf31301181b861d8699f7cc.tar.xz
org.eclipse.papyrus-97aac38470f7ab344bf31301181b861d8699f7cc.zip
414686: [Table] Improve performance and scalability of Tables
https://bugs.eclipse.org/bugs/show_bug.cgi?id=414686
-rw-r--r--extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/GenericCellLabelProvider.java14
-rw-r--r--extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/Constants.java6
2 files changed, 20 insertions, 0 deletions
diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/GenericCellLabelProvider.java b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/GenericCellLabelProvider.java
index 9fac155192d..aa390a90121 100644
--- a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/GenericCellLabelProvider.java
+++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/GenericCellLabelProvider.java
@@ -33,6 +33,11 @@ import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderSer
public class GenericCellLabelProvider extends AbstractNattableCellLabelProvider {
/**
+ * Limit the number of displayed elements for collections
+ */
+ public static final int MAX_DISPLAYED_ELEMENTS = 10;
+
+ /**
*
* @see org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider#accept(java.lang.Object)
*
@@ -63,13 +68,22 @@ public class GenericCellLabelProvider extends AbstractNattableCellLabelProvider
if(value instanceof Collection<?>) {
Iterator<?> iter = ((Collection<?>)value).iterator();
label += Constants.BEGIN_OF_COLLECTION;
+ int i = 1;
while(iter.hasNext()) {
+ if(i > MAX_DISPLAYED_ELEMENTS) {
+ label += Constants.BIG_COLLECTION;
+ break;
+ }
+
Object current = iter.next();
label += service.getLabelProvider(current).getText(current);
if(iter.hasNext()) {
label += Constants.SEPARATOR;
}
+
+ i++;
}
+
label += Constants.END_OF_COLLECTION;
} else {
label = service.getLabelProvider(value).getText(value);
diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/Constants.java b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/Constants.java
index 0517e316ab6..16ca7e7c874 100644
--- a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/Constants.java
+++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/Constants.java
@@ -25,6 +25,12 @@ public class Constants {
public static final String END_OF_COLLECTION = "]"; //$NON-NLS-1$
+ /**
+ * The String used to represent big collections
+ * Example: [v1, v2, v3, ...]
+ */
+ public static final String BIG_COLLECTION = "..."; //$NON-NLS-1$
+
public static final String SEPARATOR = ", "; //$NON-NLS-1$
public static final String NOT_AVALAIBLE = "N/A";//$NON-NLS-1$

Back to the top