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

Print this page




 149 
 150     /**
 151      * This method will be called when the ComboBox popup should be displayed.
 152      * It is up to specific skin implementations to determine how this is handled.
 153      */
 154     public abstract void show();
 155 
 156     /**
 157      * This method will be called when the ComboBox popup should be hidden.
 158      * It is up to specific skin implementations to determine how this is handled.
 159      */
 160     public abstract void hide();
 161 
 162     /** {@inheritDoc} */
 163     @Override protected void layoutChildren(final double x, final double y,
 164             final double w, final double h) {
 165         if (displayNode == null) {
 166             updateDisplayArea();
 167         }
 168 
 169         final double arrowWidth = snapSize(arrow.prefWidth(-1));
 170         final double arrowButtonWidth = (isButton()) ? 0 :
 171                 arrowButton.snappedLeftInset() + arrowWidth +
 172                 arrowButton.snappedRightInset();
 173 
 174         if (displayNode != null) {
 175             displayNode.resizeRelocate(x, y, w - arrowButtonWidth, h);
 176         }
 177 
 178         arrowButton.setVisible(! isButton());
 179         if (! isButton()) {
 180             arrowButton.resize(arrowButtonWidth, h);
 181             positionInArea(arrowButton, (x + w) - arrowButtonWidth, y,
 182                     arrowButtonWidth, h, 0, HPos.CENTER, VPos.CENTER);
 183         }
 184     }
 185 
 186     /** {@inheritDoc} */
 187     @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
 188         if (displayNode == null) {
 189             updateDisplayArea();
 190         }
 191 
 192         final double arrowWidth = snapSize(arrow.prefWidth(-1));
 193         final double arrowButtonWidth = isButton() ? 0 :
 194                                         arrowButton.snappedLeftInset() +
 195                                         arrowWidth +
 196                                         arrowButton.snappedRightInset();
 197         final double displayNodeWidth = displayNode == null ? 0 : displayNode.prefWidth(height);
 198 
 199         final double totalWidth = displayNodeWidth + arrowButtonWidth;
 200         return leftInset + totalWidth + rightInset;
 201     }
 202 
 203     /** {@inheritDoc} */
 204     @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
 205         if (displayNode == null) {
 206             updateDisplayArea();
 207         }
 208 
 209         double ph;
 210         if (displayNode == null) {
 211             final int DEFAULT_HEIGHT = 21;
 212             double arrowHeight = (isButton()) ? 0 :




 149 
 150     /**
 151      * This method will be called when the ComboBox popup should be displayed.
 152      * It is up to specific skin implementations to determine how this is handled.
 153      */
 154     public abstract void show();
 155 
 156     /**
 157      * This method will be called when the ComboBox popup should be hidden.
 158      * It is up to specific skin implementations to determine how this is handled.
 159      */
 160     public abstract void hide();
 161 
 162     /** {@inheritDoc} */
 163     @Override protected void layoutChildren(final double x, final double y,
 164             final double w, final double h) {
 165         if (displayNode == null) {
 166             updateDisplayArea();
 167         }
 168 
 169         final double arrowWidth = snapSizeX(arrow.prefWidth(-1));
 170         final double arrowButtonWidth = (isButton()) ? 0 :
 171                 arrowButton.snappedLeftInset() + arrowWidth +
 172                 arrowButton.snappedRightInset();
 173 
 174         if (displayNode != null) {
 175             displayNode.resizeRelocate(x, y, w - arrowButtonWidth, h);
 176         }
 177 
 178         arrowButton.setVisible(! isButton());
 179         if (! isButton()) {
 180             arrowButton.resize(arrowButtonWidth, h);
 181             positionInArea(arrowButton, (x + w) - arrowButtonWidth, y,
 182                     arrowButtonWidth, h, 0, HPos.CENTER, VPos.CENTER);
 183         }
 184     }
 185 
 186     /** {@inheritDoc} */
 187     @Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
 188         if (displayNode == null) {
 189             updateDisplayArea();
 190         }
 191 
 192         final double arrowWidth = snapSizeX(arrow.prefWidth(-1));
 193         final double arrowButtonWidth = isButton() ? 0 :
 194                                         arrowButton.snappedLeftInset() +
 195                                         arrowWidth +
 196                                         arrowButton.snappedRightInset();
 197         final double displayNodeWidth = displayNode == null ? 0 : displayNode.prefWidth(height);
 198 
 199         final double totalWidth = displayNodeWidth + arrowButtonWidth;
 200         return leftInset + totalWidth + rightInset;
 201     }
 202 
 203     /** {@inheritDoc} */
 204     @Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
 205         if (displayNode == null) {
 206             updateDisplayArea();
 207         }
 208 
 209         double ph;
 210         if (displayNode == null) {
 211             final int DEFAULT_HEIGHT = 21;
 212             double arrowHeight = (isButton()) ? 0 :