changeset 1249:9897f5b8a23d

RT-22122: When reordering TableColumns in a TableView, sometimes the header area disappears
author jgiles
date Thu, 07 Jun 2012 12:51:18 +1200
parents 29dd9c8675ec
children 60301b7fd01f
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableHeaderRow.java
diffstat 2 files changed, 1 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Thu Jun 07 11:13:11 2012 +1200
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Thu Jun 07 12:51:18 2012 +1200
@@ -73,7 +73,6 @@
         } else if (getTableColumn() != null) {
             setColumns(getTableColumn().getColumns());
         }
-//        getColumns().addListener(weakColumnsListener);
     }
     
     
@@ -458,7 +457,7 @@
 
         newCol.setTableHeaderRow(getTableHeaderRow());
         newCol.setParentHeader(this);
-
+        
         return newCol;
     }
 }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableHeaderRow.java	Thu Jun 07 11:13:11 2012 +1200
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableHeaderRow.java	Thu Jun 07 12:51:18 2012 +1200
@@ -207,7 +207,6 @@
 
         updateTableWidth();
         table.widthProperty().addListener(weakTableWidthListener);
-        table.getVisibleLeafColumns().addListener(weakVisibleLeafColumnsListener);
 
         // --- popup menu for hiding/showing columns
         columnPopupMenu = new ContextMenu();
@@ -287,21 +286,12 @@
      *                                                                         *
      **************************************************************************/    
     
-    private boolean headerDirty = false;
-    
     private InvalidationListener tableWidthListener = new InvalidationListener() {
         @Override public void invalidated(Observable valueModel) {
             updateTableWidth();
         }
     };
     
-    private ListChangeListener visibleLeafColumnsListener = new ListChangeListener<TableColumn<?,?>>() {
-        @Override public void onChanged(Change<? extends TableColumn<?,?>> c) {
-            headerDirty = true;
-            requestLayout();
-        }
-    };
-    
     private final ListChangeListener tableColumnsListener = new ListChangeListener<TableColumn<?,?>>() {
         @Override public void onChanged(Change<? extends TableColumn<?,?>> c) {
             while (c.next()) {
@@ -313,9 +303,6 @@
     private final WeakInvalidationListener weakTableWidthListener = 
             new WeakInvalidationListener(tableWidthListener);
     
-    private final WeakListChangeListener weakVisibleLeafColumnsListener =
-            new WeakListChangeListener(visibleLeafColumnsListener);
-    
     private final WeakListChangeListener weakTableColumnsListener =
             new WeakListChangeListener(tableColumnsListener);
     
@@ -385,11 +372,6 @@
     }
 
     @Override protected void layoutChildren() {
-        if (headerDirty) {
-            header.setColumns(table.getColumns());
-            headerDirty = false;
-        }
-        
         double x = scrollX;
         double headerWidth = snapSize(header.prefWidth(-1));
         double prefHeight = getHeight() - getInsets().getTop() - getInsets().getBottom();