modules/graphics/src/main/java/javafx/css/converter/EffectConverter.java

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


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   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.converters;
  27 
  28 import com.sun.javafx.css.Size;
  29 import com.sun.javafx.css.StyleConverterImpl;
  30 import javafx.css.ParsedValue;
  31 import javafx.css.StyleConverter;
  32 import javafx.scene.effect.BlurType;
  33 import javafx.scene.effect.DropShadow;
  34 import javafx.scene.effect.Effect;
  35 import javafx.scene.effect.InnerShadow;
  36 import javafx.scene.paint.Color;
  37 import javafx.scene.text.Font;
  38 
  39 import java.util.Map;
  40 
  41 public class EffectConverter extends StyleConverterImpl<ParsedValue[], Effect> {



  42 
  43     // lazy, thread-safe instatiation
  44     private static class Holder {
  45         static final EffectConverter EFFECT_CONVERTER =
  46                 new EffectConverter();
  47         static final DropShadowConverter DROP_SHADOW_INSTANCE =
  48                 new DropShadowConverter();
  49         static final InnerShadowConverter INNER_SHADOW_INSTANCE =
  50                 new InnerShadowConverter();
  51     }
  52 
  53     public static StyleConverter<ParsedValue[], Effect> getInstance() {
  54         return Holder.EFFECT_CONVERTER;
  55     }
  56     
  57     @Override
  58     public Effect convert(ParsedValue<ParsedValue[], Effect> value, Font font) {
  59         throw new IllegalArgumentException("Parsed value is not an Effect");
  60     }    
  61 




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   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 javafx.css.converter;
  27 
  28 import javafx.css.Size;

  29 import javafx.css.ParsedValue;
  30 import javafx.css.StyleConverter;
  31 import javafx.scene.effect.BlurType;
  32 import javafx.scene.effect.DropShadow;
  33 import javafx.scene.effect.Effect;
  34 import javafx.scene.effect.InnerShadow;
  35 import javafx.scene.paint.Color;
  36 import javafx.scene.text.Font;
  37 
  38 import java.util.Map;
  39 
  40 /**
  41  * @since 9
  42  */
  43 public class EffectConverter extends StyleConverter<ParsedValue[], Effect> {
  44 
  45     // lazy, thread-safe instatiation
  46     private static class Holder {
  47         static final EffectConverter EFFECT_CONVERTER =
  48                 new EffectConverter();
  49         static final DropShadowConverter DROP_SHADOW_INSTANCE =
  50                 new DropShadowConverter();
  51         static final InnerShadowConverter INNER_SHADOW_INSTANCE =
  52                 new InnerShadowConverter();
  53     }
  54 
  55     public static StyleConverter<ParsedValue[], Effect> getInstance() {
  56         return Holder.EFFECT_CONVERTER;
  57     }
  58     
  59     @Override
  60     public Effect convert(ParsedValue<ParsedValue[], Effect> value, Font font) {
  61         throw new IllegalArgumentException("Parsed value is not an Effect");
  62     }    
  63