changeset 1195:a3957c32490c

merge
author Paru Somashekar <paru.somashekar@oracle.com>
date Wed, 30 May 2012 15:14:34 -0700
parents 42244b08c655 12d9e19e9c1a
children c8cde1376f90
files
diffstat 4 files changed, 27 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Wed May 30 15:10:51 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/NestedTableColumnHeader.java	Wed May 30 15:14:34 2012 -0700
@@ -59,21 +59,21 @@
      *                                                                         *
      **************************************************************************/
     
-    public NestedTableColumnHeader(TableView table, TableColumn tc) {
+    NestedTableColumnHeader(TableView table, TableColumn tc) {
         super(table, tc);
 
         getStyleClass().setAll("nested-column-header");
         setFocusTraversable(false);
 
         initUI();
-
+        
         // watching for changes to the view columns in either table or tableColumn.
         if (getTableColumn() == null && getTableView() != null) {
             setColumns(getTableView().getColumns());
         } else if (getTableColumn() != null) {
             setColumns(getTableColumn().getColumns());
         }
-        getColumns().addListener(weakColumnsListener);
+//        getColumns().addListener(weakColumnsListener);
     }
     
     
@@ -136,10 +136,18 @@
      * It does NOT include ANY of the children of these columns, if any exist.
      */
     private ObservableList<? extends TableColumn> columns;
-    public ObservableList<? extends TableColumn> getColumns() { return columns; }
-    public void setColumns(ObservableList<? extends TableColumn> newColumns) {
+    ObservableList<? extends TableColumn> getColumns() { return columns; }
+    void setColumns(ObservableList<? extends TableColumn> newColumns) {
+        if (this.columns != null) {
+            this.columns.removeListener(weakColumnsListener);
+        }
+        
         this.columns = newColumns;  
         
+        if (this.columns != null) {
+            this.columns.addListener(weakColumnsListener);
+        }
+        
         // update the column headers....
         
         // iterate through all current headers, telling them to clean up
@@ -370,7 +378,7 @@
     /* **************************/
 
     @Override protected void layoutChildren() {
-        double w = snapSize(getWidth()) - snapSpace(getInsets().getLeft()) - snapSpace(getInsets().getRight());
+        double w = getWidth() - getInsets().getLeft() - getInsets().getRight();
         double h = getHeight() - getInsets().getTop() - getInsets().getBottom();
         
         int labelHeight = (int) label.prefHeight(-1);
@@ -387,7 +395,7 @@
         for (TableColumnHeader n : getColumnHeaders()) {
             if (! n.isVisible()) continue;
             
-            double prefWidth = snapSize(n.prefWidth(-1));
+            double prefWidth = n.prefWidth(-1);
 //            double prefHeight = n.prefHeight(-1);
 
             // position the column header in the default location...
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableColumnHeader.java	Wed May 30 15:10:51 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableColumnHeader.java	Wed May 30 15:14:34 2012 -0700
@@ -387,10 +387,9 @@
         // we do not support sorting in embedded devices
         if (! isSortingEnabled()) return;
         
+        isSortColumn = sortPos != -1;
         if (! isSortColumn) return;
         
-        isSortColumn = sortPos != -1;
-        
         final int sortColumnCount = getTableView().getSortOrder().size();
         boolean showSortOrderDots = sortPos <= 3 && sortColumnCount > 1;
         
--- a/javafx-ui-controls/src/javafx/scene/control/ComboBox.java	Wed May 30 15:10:51 2012 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/ComboBox.java	Wed May 30 15:14:34 2012 -0700
@@ -230,10 +230,6 @@
             @Override public void invalidated(Observable o) {
                 // when editable changes, we reset the selection / value states
                 getSelectionModel().clearSelection();
-                
-                // we also change the editor property so that it is null when
-                // editable is false, and non-null when it is true.
-                updateEditor();
             }
         });
     }
@@ -345,6 +341,7 @@
     
     
     // --- Editor
+    private FocusableTextField textField;
     /**
      * The editor for the ComboBox. The editor is null if the ComboBox is not
      * {@link #editableProperty() editable}.
@@ -354,8 +351,12 @@
         return editorProperty().get(); 
     }
     public final ReadOnlyObjectProperty<TextField> editorProperty() { 
-        if (editor == null || (editor.get() == null && isEditable())) {
-            updateEditor();
+        if (editor == null) {
+            editor = new ReadOnlyObjectWrapper<TextField>(this, "editor");
+            textField = new FocusableTextField();
+            textField.promptTextProperty().bindBidirectional(promptTextProperty());
+            textField.tooltipProperty().bind(tooltipProperty());
+            editor.set(textField);
         }
         return editor.getReadOnlyProperty(); 
     }
@@ -386,23 +387,8 @@
      *                                                                         *
      **************************************************************************/        
 
-    private FocusableTextField textField;
     
-    private void updateEditor() {
-        if (editor == null) {
-            editor = new ReadOnlyObjectWrapper<TextField>(this, "editor");
-        }
-        
-        if (isEditable()) {
-            textField = new FocusableTextField();
-            textField.promptTextProperty().bindBidirectional(promptTextProperty());
-            textField.tooltipProperty().bind(tooltipProperty());
-            editor.set(textField);
-        } else {
-            textField = null;
-            editor.set(null);
-        }
-    }
+    
 
     
     
--- a/javafx-ui-controls/src/javafx/scene/control/TableView.java	Wed May 30 15:10:51 2012 -0700
+++ b/javafx-ui-controls/src/javafx/scene/control/TableView.java	Wed May 30 15:14:34 2012 -0700
@@ -679,9 +679,6 @@
                     // set up listeners
                     removeTableColumnListener(c.getRemoved());
                     addTableColumnListener(c.getAddedSubList());
-
-                    removeColumnsListener(c.getRemoved(), weakColumnsObserver);
-                    addColumnsListener(c.getAddedSubList(), weakColumnsObserver);
                 }
                     
                 // We don't maintain a bind for leafColumns, we simply call this update
@@ -762,6 +759,9 @@
             // Fix for RT-15194: Need to remove removed columns from the 
             // sortOrder list.
             while (c.next()) {
+                removeColumnsListener(c.getRemoved(), weakColumnsObserver);
+                addColumnsListener(c.getAddedSubList(), weakColumnsObserver);
+                
                 if (c.wasRemoved()) {
                     for (int i = 0; i < c.getRemovedSize(); i++) {
                         getSortOrder().remove(c.getRemoved().get(i));