Goktug Gokdogan has submitted this change and it was merged.

Change subject: Set display to none for table columns that should not be visible.
......................................................................


Set display to none for table columns that should not be visible.

Change-Id: Id5eabeda8a3ef2f7b851d540c3776026984654c3
Review-Link: https://gwt-review.googlesource.com/#/c/3390/
---
M user/src/com/google/gwt/user/cellview/client/CellTable.java
M user/test/com/google/gwt/user/cellview/client/CellTableTest.java
2 files changed, 14 insertions(+), 5 deletions(-)

Approvals:
  Leeroy Jenkins: Verified
  Goktug Gokdogan: Looks good to me, approved



diff --git a/user/src/com/google/gwt/user/cellview/client/CellTable.java b/user/src/com/google/gwt/user/cellview/client/CellTable.java
index 12b3db2..a3a1d57 100644
--- a/user/src/com/google/gwt/user/cellview/client/CellTable.java
+++ b/user/src/com/google/gwt/user/cellview/client/CellTable.java
@@ -18,6 +18,7 @@
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.dom.client.BrowserEvents;
 import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Style.Display;
 import com.google.gwt.dom.client.Style.TableLayout;
 import com.google.gwt.dom.client.Style.Unit;
 import com.google.gwt.dom.client.TableCellElement;
@@ -889,14 +890,21 @@
     super.refreshColumnWidths();

     /*
- * Set the width to zero for all col elements that appear after the last - * column. Clearing the width would cause it to take up the remaining width
-     * in a fixed layout table.
+ * Set the width to zero and the display to none for all col elements that + * appear after the last column. Clearing the width would cause it to take
+     * up the remaining width in a fixed layout table.
+     *
+     * Clear the display for all columns that appear in the table.
      */
     if (colGroupEnabled) {
       int colCount = colgroup.getChildCount();
-      for (int i = getRealColumnCount(); i < colCount; i++) {
+      int lastColumn = getRealColumnCount();
+      for (int i = 0; i < lastColumn; i++) {
+        ensureTableColElement(i).getStyle().clearDisplay();
+      }
+      for (int i = lastColumn; i < colCount; i++) {
         doSetColumnWidth(i, "0px");
+        ensureTableColElement(i).getStyle().setDisplay(Display.NONE);
       }
     }
   }
diff --git a/user/test/com/google/gwt/user/cellview/client/CellTableTest.java b/user/test/com/google/gwt/user/cellview/client/CellTableTest.java
index c54266f..965e59a 100644
--- a/user/test/com/google/gwt/user/cellview/client/CellTableTest.java
+++ b/user/test/com/google/gwt/user/cellview/client/CellTableTest.java
@@ -283,7 +283,7 @@
   }

   /**
-   * Test that removing a column sets its width to zero.
+ * Test that removing a column sets its width to zero and the display to none.
    */
   public void testRemoveColumnWithWidth() {
     CellTable<String> table = createAbstractHasData(new TextCell());
@@ -297,6 +297,7 @@
     table.removeColumn(column1);
     table.getPresenter().flush();
     assertEquals("0px", col1.getStyle().getWidth());
+    assertEquals("none", col1.getStyle().getDisplay().toLowerCase());
   }

   @Override

--
To view, visit https://gwt-review.googlesource.com/3390
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id5eabeda8a3ef2f7b851d540c3776026984654c3
Gerrit-PatchSet: 3
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Aliseya Wright <alis...@google.com>
Gerrit-Reviewer: Aliseya Wright <alis...@google.com>
Gerrit-Reviewer: Goktug Gokdogan <gok...@google.com>
Gerrit-Reviewer: Leeroy Jenkins <jenk...@gwtproject.org>

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to