Alexander Wels has uploaded a new change for review.

Change subject: userportal,webadmin: ensureColumnPresentFix
......................................................................

userportal,webadmin: ensureColumnPresentFix

- ensureColumnPresentFix would check if the column existed and
  then would remove it and add it back again. This would cause
  the index of the column to fluctuate and cause the width loading
  to fail. This patch fixes the issue.

Change-Id: I82f725fd98a1690c16fd01a40fa1c05a27d3237e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1124546
Signed-off-by: Alexander Wels <aw...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ColumnResizeCellTable.java
1 file changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/83/34283/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ColumnResizeCellTable.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ColumnResizeCellTable.java
index 37216d9..8a79b9a 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ColumnResizeCellTable.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/table/resize/ColumnResizeCellTable.java
@@ -222,21 +222,21 @@
      * Ensures that the given column is added (or removed), unless it's 
already present (or absent).
      * <p>
      * This method also sets the column width in case the column needs to be 
added.
+     * @param column The column to ensure is there.
+     * @param headerText The header text associated with the column.
+     * @param present If true make sure the column is there, if false make 
sure it is not.
+     * @param width The width of the column.
      */
     public void ensureColumnPresent(Column<T, ?> column, String headerText, 
boolean present, String width) {
-        if (present) {
-            // Remove the column first
-            if (getColumnIndex(column) != -1) {
-                removeColumn(column);
-            }
-
-            // Re-add the column
+        boolean columnPresent = getColumnIndex(column) != -1;
+        if (present && !columnPresent) {
+            // Add the column
             if (width == null) {
                 addColumnWithHtmlHeader(column, headerText);
             } else {
                 addColumnWithHtmlHeader(column, headerText, width);
             }
-        } else if (!present && getColumnIndex(column) != -1) {
+        } else if (!present && columnPresent) {
             // Remove the column
             removeColumn(column);
         }


-- 
To view, visit http://gerrit.ovirt.org/34283
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82f725fd98a1690c16fd01a40fa1c05a27d3237e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Alexander Wels <aw...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to