< prev index next >

modules/javafx.controls/src/main/java/javafx/scene/control/ListCell.java

Print this page




 476                 }
 477             }
 478             updateItem(newValue, false);
 479         } else {
 480             // RT-30484 We need to allow a first run to be special-cased to allow
 481             // for the updateItem method to be called at least once to allow for
 482             // the correct visual state to be set up. In particular, in RT-30484
 483             // refer to Ensemble8PopUpTree.png - in this case the arrows are being
 484             // shown as the new cells are instantiated with the arrows in the
 485             // children list, and are only hidden in updateItem.
 486             if ((!isEmpty && oldValue != null) || firstRun) {
 487                 updateItem(null, true);
 488                 firstRun = false;
 489             }
 490         }
 491     }
 492 
 493     /**
 494      * Updates the ListView associated with this Cell.
 495      *
 496      * @expert This function is intended to be used by experts, primarily
 497      *         by those implementing new Skins. It is not common
 498      *         for developers or designers to access this function directly.

 499      */
 500     public final void updateListView(ListView<T> listView) {
 501         setListView(listView);
 502     }
 503 
 504     private void updateSelection() {
 505         if (isEmpty()) return;
 506         int index = getIndex();
 507         ListView<T> listView = getListView();
 508         if (index == -1 || listView == null) return;
 509 
 510         SelectionModel<T> sm = listView.getSelectionModel();
 511         if (sm == null) {
 512             updateSelected(false);
 513             return;
 514         }
 515 
 516         boolean isSelected = sm.isSelected(index);
 517         if (isSelected() == isSelected) return;
 518 




 476                 }
 477             }
 478             updateItem(newValue, false);
 479         } else {
 480             // RT-30484 We need to allow a first run to be special-cased to allow
 481             // for the updateItem method to be called at least once to allow for
 482             // the correct visual state to be set up. In particular, in RT-30484
 483             // refer to Ensemble8PopUpTree.png - in this case the arrows are being
 484             // shown as the new cells are instantiated with the arrows in the
 485             // children list, and are only hidden in updateItem.
 486             if ((!isEmpty && oldValue != null) || firstRun) {
 487                 updateItem(null, true);
 488                 firstRun = false;
 489             }
 490         }
 491     }
 492 
 493     /**
 494      * Updates the ListView associated with this Cell.
 495      *
 496      * Note: This function is intended to be used by experts, primarily
 497      *       by those implementing new Skins. It is not common
 498      *       for developers or designers to access this function directly.
 499      * @param listView the ListView associated with this cell
 500      */
 501     public final void updateListView(ListView<T> listView) {
 502         setListView(listView);
 503     }
 504 
 505     private void updateSelection() {
 506         if (isEmpty()) return;
 507         int index = getIndex();
 508         ListView<T> listView = getListView();
 509         if (index == -1 || listView == null) return;
 510 
 511         SelectionModel<T> sm = listView.getSelectionModel();
 512         if (sm == null) {
 513             updateSelected(false);
 514             return;
 515         }
 516 
 517         boolean isSelected = sm.isSelected(index);
 518         if (isSelected() == isSelected) return;
 519 


< prev index next >