modules/graphics/src/test/java/com/sun/javafx/css/TestNodeBase.java

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


   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.css;
  27 
  28 import com.sun.javafx.css.converters.BooleanConverter;
  29 import com.sun.javafx.css.converters.SizeConverter;
  30 import com.sun.javafx.css.converters.StringConverter;
  31 import java.util.ArrayList;
  32 import java.util.Collections;
  33 import java.util.List;
  34 
  35 import com.sun.javafx.sg.prism.NGNode;
  36 import javafx.beans.property.BooleanProperty;
  37 import javafx.beans.property.DoubleProperty;
  38 import javafx.beans.property.StringProperty;
  39 import javafx.css.CssMetaData;
  40 import javafx.css.StyleableBooleanProperty;
  41 import javafx.css.StyleableDoubleProperty;
  42 import javafx.css.StyleableStringProperty;
  43 import javafx.scene.Node;
  44 
  45 import com.sun.javafx.geom.BaseBounds;
  46 import com.sun.javafx.geom.transform.BaseTransform;
  47 import com.sun.javafx.jmx.MXNodeAlgorithm;
  48 import com.sun.javafx.jmx.MXNodeAlgorithmContext;
  49 import javafx.css.Styleable;
  50 import javafx.css.StyleableProperty;
  51 
  52 /** Test Node with styleable properties and an getClassCssMetaData method */
  53 class TestNodeBase extends Node {
  54 
  55     protected TestNodeBase() {
  56     }
  57 
  58     @Override
  59     protected boolean impl_computeContains(double d, double d1) {
  60         throw new UnsupportedOperationException("Not supported yet.");
  61     }
  62 
  63     @Override
  64     public BaseBounds impl_computeGeomBounds(BaseBounds bb, BaseTransform bt) {
  65         throw new UnsupportedOperationException("Not supported yet.");
  66     }
  67 
  68     @Override
  69     protected NGNode impl_createPeer() {
  70         throw new UnsupportedOperationException("Not supported yet.");
  71     }
  72 
  73     private BooleanProperty test;


 153 
 154                 @Override
 155                 public CssMetaData getCssMetaData() {
 156                     return TestNodeBase.StyleableProperties.DOUBLE_PROPERTY;
 157                 }
 158                 
 159             };
 160         }
 161         return doubleProperty;
 162     }
 163     
 164     public void setDoubleProperty(double number) {
 165         doublePropertyProperty().set(number);
 166     }
 167     
 168     public double getDoubleProperty() {
 169         return (doubleProperty == null ? 0 : doubleProperty.get());
 170     }
 171     
 172 
 173     static class StyleableProperties {
 174         public final static CssMetaData<TestNodeBase,Boolean> TEST =
 175                 new CssMetaData<TestNodeBase,Boolean>("-fx-test", 
 176                 BooleanConverter.getInstance(), Boolean.TRUE) {
 177 
 178             @Override
 179             public boolean isSettable(TestNodeBase n) {
 180                 return n.test == null || !n.test.isBound();
 181             }
 182 
 183             @Override
 184             public StyleableProperty<Boolean> getStyleableProperty(TestNodeBase n) {
 185                 return (StyleableProperty)n.testProperty();
 186             }
 187         };
 188 
 189         public final static CssMetaData<TestNodeBase,String> STRING =
 190                 new CssMetaData<TestNodeBase,String>("-fx-string", 
 191                 StringConverter.getInstance(), "init string") {
 192 
 193             @Override




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.css;
  27 
  28 import javafx.css.converter.BooleanConverter;
  29 import javafx.css.converter.SizeConverter;
  30 import javafx.css.converter.StringConverter;
  31 import java.util.ArrayList;
  32 import java.util.Collections;
  33 import java.util.List;
  34 
  35 import com.sun.javafx.sg.prism.NGNode;
  36 import javafx.beans.property.BooleanProperty;
  37 import javafx.beans.property.DoubleProperty;
  38 import javafx.beans.property.StringProperty;
  39 import javafx.css.CssMetaData;
  40 import javafx.css.StyleableBooleanProperty;
  41 import javafx.css.StyleableDoubleProperty;
  42 import javafx.css.StyleableStringProperty;
  43 import javafx.scene.Node;
  44 
  45 import com.sun.javafx.geom.BaseBounds;
  46 import com.sun.javafx.geom.transform.BaseTransform;
  47 import com.sun.javafx.jmx.MXNodeAlgorithm;
  48 import com.sun.javafx.jmx.MXNodeAlgorithmContext;
  49 import javafx.css.Styleable;
  50 import javafx.css.StyleableProperty;
  51 
  52 /** Test Node with styleable properties and an getClassCssMetaData method */
  53 public class TestNodeBase extends Node {
  54 
  55     protected TestNodeBase() {
  56     }
  57 
  58     @Override
  59     protected boolean impl_computeContains(double d, double d1) {
  60         throw new UnsupportedOperationException("Not supported yet.");
  61     }
  62 
  63     @Override
  64     public BaseBounds impl_computeGeomBounds(BaseBounds bb, BaseTransform bt) {
  65         throw new UnsupportedOperationException("Not supported yet.");
  66     }
  67 
  68     @Override
  69     protected NGNode impl_createPeer() {
  70         throw new UnsupportedOperationException("Not supported yet.");
  71     }
  72 
  73     private BooleanProperty test;


 153 
 154                 @Override
 155                 public CssMetaData getCssMetaData() {
 156                     return TestNodeBase.StyleableProperties.DOUBLE_PROPERTY;
 157                 }
 158                 
 159             };
 160         }
 161         return doubleProperty;
 162     }
 163     
 164     public void setDoubleProperty(double number) {
 165         doublePropertyProperty().set(number);
 166     }
 167     
 168     public double getDoubleProperty() {
 169         return (doubleProperty == null ? 0 : doubleProperty.get());
 170     }
 171     
 172 
 173     public static class StyleableProperties {
 174         public final static CssMetaData<TestNodeBase,Boolean> TEST =
 175                 new CssMetaData<TestNodeBase,Boolean>("-fx-test", 
 176                 BooleanConverter.getInstance(), Boolean.TRUE) {
 177 
 178             @Override
 179             public boolean isSettable(TestNodeBase n) {
 180                 return n.test == null || !n.test.isBound();
 181             }
 182 
 183             @Override
 184             public StyleableProperty<Boolean> getStyleableProperty(TestNodeBase n) {
 185                 return (StyleableProperty)n.testProperty();
 186             }
 187         };
 188 
 189         public final static CssMetaData<TestNodeBase,String> STRING =
 190                 new CssMetaData<TestNodeBase,String>("-fx-string", 
 191                 StringConverter.getInstance(), "init string") {
 192 
 193             @Override