Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8321126

ImageView: add styleable fitWidth, fitHeight, preserveRatio, smooth properties

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • jfx22
    • javafx
    • None
    • source, binary
    • minimal
    • Near zero: changing existing properties in a backward-compatible manner, adds new CSS property names.
    • File or wire format
    • JDK

      Summary

      Changing four existing ImageView properties to styleable properties, with the names

      -fx-preserve-ratio
      -fx-smooth
      -fx-fit-width
      -fx-fit-height

      Problem

      The app developers want to control these properties via CSS style sheet.

      Solution

      The solution is to change these four properties in ImageView to Styleable*Property and include them in public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData().

      Specification

      The change affects return value of a static method and the CSS Reference document:

      --- a/modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html
      +++ b/modules/javafx.graphics/src/main/docs/javafx/scene/doc-files/cssref.html
      @@ -1882,12 +1882,35 @@
             </thead>
             <tbody>
               <tr>
      -        <th class="propertyname" scope="row">-fx-image</th>
      +          <th class="propertyname" scope="row">-fx-fit-height</th>
      +          <td class="value"><a href="#typenumber" class="typelink">&lt;number&gt;</a></td>
      +          <td class="default">0</td>
      +          <td>The height of the bounding box within which the source image is resized as necessary to fit.</td>
      +        </tr>
      +        <tr>
      +          <th class="propertyname" scope="row">-fx-fit-width</th>
      +          <td class="value"><a href="#typenumber" class="typelink">&lt;number&gt;</a></td>
      +          <td class="default">0</td>
      +          <td>The width of the bounding box within which the source image is resized as necessary to fit.</td>
      +        </tr>
      +          <th class="propertyname" scope="row">-fx-image</th>
                 <td class="value"><a href="#typeurl" class="typelink">&lt;uri&gt;</a></td>
                 <td class="default">null</td>
                 <td>Relative URLs are resolved against the URL of the stylesheet.</td>
               </tr>
               <tr>
      +          <th class="propertyname" scope="row">-fx-preserve-ratio</th>
      +          <td class="value"><a href="#typeboolean" class="typelink">&lt;boolean&gt;</a></td>
      +          <td class="default">false</td>
      +          <td>Indicates whether to preserve the aspect ratio of the source image when scaling to fit the image within the fitting bounding box.</td>
      +        </tr>
      +        <tr>
      +          <th class="propertyname" scope="row">-fx-smooth</th>
      +          <td class="value"><a href="#typeboolean" class="typelink">&lt;boolean&gt;</a></td>
      +          <td class="default">Platform-specific</td>
      +          <td>Indicates whether to use a better quality filtering algorithm or a faster one when transforming or scaling the source image to fit.</td>
      +        </tr>
      +        <tr>
               <th colspan="4" class="parents" scope="row">Also has all properties of <a href="#node">Node</a></th>
               </tr>
             </tbody>

            angorya Andy Goryachev
            angorya Andy Goryachev
            Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: