modules/controls/src/main/java/com/sun/javafx/scene/control/skin/WebColorFieldSkin.java

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

*** 1,7 **** /* ! * Copyright (c) 2012, 2014, 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 --- 1,7 ---- /* ! * Copyright (c) 2012, 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
*** 25,42 **** package com.sun.javafx.scene.control.skin; import java.util.Locale; import javafx.beans.InvalidationListener; import javafx.geometry.NodeOrientation; import javafx.scene.Node; import javafx.scene.paint.Color; /** */ ! class WebColorFieldSkin extends InputFieldSkin { private InvalidationListener integerFieldValueListener; private boolean noChangeInValue = false; /** * Create a new WebColorFieldSkin. --- 25,44 ---- package com.sun.javafx.scene.control.skin; import java.util.Locale; + import com.sun.javafx.scene.control.WebColorField; import javafx.beans.InvalidationListener; import javafx.geometry.NodeOrientation; import javafx.scene.Node; + import javafx.scene.control.skin.ColorPickerSkin; import javafx.scene.paint.Color; /** */ ! public class WebColorFieldSkin extends InputFieldSkin { private InvalidationListener integerFieldValueListener; private boolean noChangeInValue = false; /** * Create a new WebColorFieldSkin.
*** 89,99 **** } protected void updateText() { Color color = ((WebColorField) control).getValue(); if (color == null) color = Color.BLACK; ! getTextField().setText(ColorPickerSkin.formatHexString(color)); } protected void updateValue() { if (noChangeInValue) return; Color value = ((WebColorField) control).getValue(); --- 91,101 ---- } protected void updateText() { Color color = ((WebColorField) control).getValue(); if (color == null) color = Color.BLACK; ! getTextField().setText(Utils.formatHexString(color)); } protected void updateValue() { if (noChangeInValue) return; Color value = ((WebColorField) control).getValue();
*** 105,115 **** ((WebColorField) control).setValue(newValue); } else { // calling setText results in updateValue - so we set this flag to true // so that when this is true updateValue simply returns. noChangeInValue = true; ! getTextField().setText(ColorPickerSkin.formatHexString(newValue)); noChangeInValue = false; } } catch (java.lang.IllegalArgumentException ex) { System.out.println("Failed to parse ["+text+"]"); } --- 107,117 ---- ((WebColorField) control).setValue(newValue); } else { // calling setText results in updateValue - so we set this flag to true // so that when this is true updateValue simply returns. noChangeInValue = true; ! getTextField().setText(Utils.formatHexString(newValue)); noChangeInValue = false; } } catch (java.lang.IllegalArgumentException ex) { System.out.println("Failed to parse ["+text+"]"); }