modules/controls/src/main/java/javafx/scene/control/skin/CellSkinBase.java

Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -21,39 +21,75 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
-package com.sun.javafx.scene.control.skin;
+package javafx.scene.control.skin;
 
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import com.sun.javafx.scene.control.behavior.BehaviorBase;
-
+import javafx.scene.Node;
 import javafx.scene.control.Cell;
 import javafx.css.StyleableDoubleProperty;
 import javafx.css.CssMetaData;
 import javafx.css.StyleOrigin;
 
-import com.sun.javafx.css.converters.SizeConverter;
+import javafx.css.converter.SizeConverter;
 
 import javafx.beans.property.DoubleProperty;
 import javafx.beans.property.ReadOnlyDoubleProperty;
 import javafx.beans.value.WritableValue;
 import javafx.css.Styleable;
 import javafx.css.StyleableProperty;
+import javafx.scene.control.Control;
 import javafx.scene.control.SkinBase;
 
-
 /**
- * A base skin implementation, specifically for ListCellSkin and TreeCellSkin.
- * This might not be a suitable base class for TreeCellSkin or some other
- * such skins.
+ * Default skin implementation for the {@link Cell} control, and subclasses such
+ * as {@link javafx.scene.control.ListCell}, {@link javafx.scene.control.TreeCell},
+ * etc.
+ *
+ * @see Cell
+ * @since 9
+ */
+public class CellSkinBase<C extends Cell> extends LabeledSkinBase<C> {
+
+    /***************************************************************************
+     *                                                                         *
+     * Constructors                                                            *
+     *                                                                         *
+     **************************************************************************/
+
+    /**
+     * Creates a new CellSkinBase instance, installing the necessary child
+     * nodes into the Control {@link Control#getChildren() children} list, as
+     * well as the necessary {@link Node#getInputMap() input mappings} for
+     * handling key, mouse, etc events.
+     *
+     * @param control The control that this skin should be installed onto.
+     */
+    public CellSkinBase(final C control) {
+        super (control);
+
+        /**
+         * The Cell does not typically want to block mouse events from going down
+         * to the virtualized controls holding the cell. For example mouse clicks
+         * on cells should also pass down to the ListView holding the cells.
  */
-public class CellSkinBase<C extends Cell, B extends BehaviorBase<C>> extends LabeledSkinBase<C, B> {
+        consumeMouseEvents(false);
+    }
+
+
+
+    /***************************************************************************
+     *                                                                         *
+     * Properties                                                              *
+     *                                                                         *
+     **************************************************************************/
+
     /**
      * The default cell size. For vertical ListView or a TreeView or TableView
      * this is the height, for a horizontal ListView this is the width. This
      * is settable from CSS
      */

@@ -105,21 +141,10 @@
             }; 
         }
         return cellSize;
     }
 
-    public CellSkinBase(final C control, final B behavior) {
-        super (control, behavior);
-
-        /**
-         * The Cell does not typically want to block mouse events from going down
-         * to the virtualized controls holding the cell. For example mouse clicks
-         * on cells should also pass down to the ListView holding the cells.
-         */
-        consumeMouseEvents(false);
-    }
-
 
     
     /***************************************************************************
      *                                                                         *
      *                         Stylesheet Handling                             *

@@ -137,17 +162,17 @@
                 new CssMetaData<Cell<?>,Number>("-fx-cell-size",
                  SizeConverter.getInstance(), DEFAULT_CELL_SIZE) {
 
             @Override
             public boolean isSettable(Cell<?> n) {
-                final CellSkinBase<?,?> skin = (CellSkinBase<?,?>) n.getSkin();
+                final CellSkinBase<?> skin = (CellSkinBase<?>) n.getSkin();
                 return skin.cellSize == null || !skin.cellSize.isBound();
             }
 
             @Override
             public StyleableProperty<Number> getStyleableProperty(Cell<?> n) {
-                final CellSkinBase<?,?> skin = (CellSkinBase<?,?>) n.getSkin();
+                final CellSkinBase<?> skin = (CellSkinBase<?>) n.getSkin();
                 return (StyleableProperty<Number>)(WritableValue<Number>)skin.cellSizePropertyImpl();
             }
         };
 
          private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;

@@ -160,21 +185,18 @@
 
          }
     }
 
     /**
-     * @return The CssMetaData associated with this class, which may include the
+     * Returns the CssMetaData associated with this class, which may include the
      * CssMetaData of its super classes.
      */
     public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() {
         return StyleableProperties.STYLEABLES;
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
+    /** {@inheritDoc} */
+    @Override public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
         return getClassCssMetaData();
     }
 
 }