Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-05-03 09:55:59 +0000
committerNicolas FAUVERGUE2016-05-03 09:55:59 +0000
commit4f474b1e56c90a7ef10072552ac4ade51898cadc (patch)
tree377a078a530709caf1506a4a0716aa9b5b750402
parent9308e7735009549ad50c309867e603f21bc48e7a (diff)
downloadorg.eclipse.papyrus-4f474b1e56c90a7ef10072552ac4ade51898cadc.tar.gz
org.eclipse.papyrus-4f474b1e56c90a7ef10072552ac4ade51898cadc.tar.xz
org.eclipse.papyrus-4f474b1e56c90a7ef10072552ac4ade51898cadc.zip
Bug 489720: [Table] In Property View, Tables are not resized based on
the view size and layout option https://bugs.eclipse.org/bugs/show_bug.cgi?id=489720 Correct the header width calculation. Change-Id: I656497a4ed25e60e77a16968870e2328e44a9d5b Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java33
1 files changed, 16 insertions, 17 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
index 776de35c33e..2f7d57ac55e 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
@@ -1462,26 +1462,25 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
final int parentSize = parent.getSize().x;
// Calculate the rows header width
- int headerWidth = 0;
- if (null != getRowHeaderLayerStack()) {
- if (null != getRowHeaderLayerStack().getIndexRowHeaderLayer()) {
- headerWidth = getRowHeaderLayerStack().getIndexRowHeaderLayer().getWidth();
+ if(0 < parentSize){
+ int headerWidth = 0;
+ if (null != getRowHeaderLayerStack()) {
+ for (int headerColumnIndex = 0; headerColumnIndex < getRowHeaderLayerStack().getColumnCount(); headerColumnIndex++) {
+ headerWidth += getRowHeaderLayerStack().getColumnWidthByPosition(headerColumnIndex);
+ }
}
- for (int headerColumnIndex = 0; headerColumnIndex < getRowHeaderLayerStack().getColumnCount(); headerColumnIndex++) {
- headerWidth = getRowHeaderLayerStack().getColumnWidthByPosition(headerColumnIndex);
+
+ // Remove the rows header size from the parent size
+ final int allColumnsSize = parentSize - headerWidth;
+
+ // Divide the width of all columns by the number of column to calculate the width by column
+ final int columnSize = allColumnsSize / getBodyLayerStack().getColumnHideShowLayer().getColumnCount();
+
+ // Affext the width to the column
+ for (int columnPosition = 0; columnPosition < getBodyLayerStack().getColumnHideShowLayer().getColumnCount(); columnPosition++) {
+ getBodyLayerStack().getBodyDataLayer().setColumnWidthByPosition(columnPosition, columnSize);
}
}
-
- // Remove the rows header size from the parent size
- final int allColumnsSize = parentSize - headerWidth;
-
- // Divide the width of all columns by the number of column to calculate the width by column
- final int columnSize = allColumnsSize / getBodyLayerStack().getColumnHideShowLayer().getColumnCount();
-
- // Affext the width to the column
- for (int columnPosition = 0; columnPosition < getBodyLayerStack().getColumnHideShowLayer().getColumnCount(); columnPosition++) {
- getBodyLayerStack().getBodyDataLayer().setColumnWidthByPosition(columnPosition, columnSize);
- }
}
}
}

Back to the top