modules/controls/src/main/java/javafx/scene/control/Control.java

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

*** 38,61 **** import javafx.beans.property.ObjectPropertyBase; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.WritableValue; import javafx.collections.ObservableList; import javafx.event.EventHandler; - import javafx.geometry.Side; import javafx.scene.AccessibleAction; import javafx.scene.AccessibleAttribute; import javafx.scene.Node; import javafx.scene.input.ContextMenuEvent; import javafx.scene.layout.Region; import com.sun.javafx.application.PlatformImpl; - import com.sun.javafx.css.CssError; import javafx.css.CssMetaData; import com.sun.javafx.css.StyleManager; import javafx.css.StyleableObjectProperty; import javafx.css.StyleableStringProperty; ! import com.sun.javafx.css.converters.StringConverter; import com.sun.javafx.scene.control.Logging; import javafx.css.Styleable; import javafx.css.StyleableProperty; import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger.Level; --- 38,60 ---- import javafx.beans.property.ObjectPropertyBase; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.WritableValue; import javafx.collections.ObservableList; + import javafx.css.CssParser; import javafx.event.EventHandler; import javafx.scene.AccessibleAction; import javafx.scene.AccessibleAttribute; import javafx.scene.Node; import javafx.scene.input.ContextMenuEvent; import javafx.scene.layout.Region; import com.sun.javafx.application.PlatformImpl; import javafx.css.CssMetaData; import com.sun.javafx.css.StyleManager; import javafx.css.StyleableObjectProperty; import javafx.css.StyleableStringProperty; ! import javafx.css.converter.StringConverter; import com.sun.javafx.scene.control.Logging; import javafx.css.Styleable; import javafx.css.StyleableProperty; import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger.Level;
*** 418,427 **** --- 417,431 ---- prop.applyStyle(null, Boolean.TRUE); // we add a listener for menu request events to show the context menu // that may be set on the Control this.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, contextMenuHandler); + + // TODO re-enable when InputMap moves back to Node / Control + // // Most controls need an input map, so we set this to be non-null in + // // Control to save people from running into NPEs. + // setInputMap(new InputMap(this)); } /***************************************************************************
*** 684,696 **** static void loadSkinClass(final Skinnable control, final String skinClassName) { if (skinClassName == null || skinClassName.isEmpty()) { final String msg = "Empty -fx-skin property specified for control " + control; ! final List<CssError> errors = StyleManager.getErrors(); if (errors != null) { ! CssError error = new CssError(msg); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg); return; } --- 688,700 ---- static void loadSkinClass(final Skinnable control, final String skinClassName) { if (skinClassName == null || skinClassName.isEmpty()) { final String msg = "Empty -fx-skin property specified for control " + control; ! final List<CssParser.ParseError> errors = StyleManager.getErrors(); if (errors != null) { ! CssParser.ParseError error = new CssParser.ParseError(msg); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg); return; }
*** 710,722 **** if (skinConstructor == null) { final String msg = "No valid constructor defined in '" + skinClassName + "' for control " + control + ".\r\nYou must provide a constructor that accepts a single " + "Skinnable (e.g. Control or PopupControl) parameter in " + skinClassName + "."; ! final List<CssError> errors = StyleManager.getErrors(); if (errors != null) { ! CssError error = new CssError(msg); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg); } else { Skin<?> skinInstance = (Skin<?>) skinConstructor.newInstance(control); --- 714,726 ---- if (skinConstructor == null) { final String msg = "No valid constructor defined in '" + skinClassName + "' for control " + control + ".\r\nYou must provide a constructor that accepts a single " + "Skinnable (e.g. Control or PopupControl) parameter in " + skinClassName + "."; ! final List<CssParser.ParseError> errors = StyleManager.getErrors(); if (errors != null) { ! CssParser.ParseError error = new CssParser.ParseError(msg); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg); } else { Skin<?> skinInstance = (Skin<?>) skinConstructor.newInstance(control);
*** 725,746 **** control.skinProperty().set(skinInstance); } } catch (InvocationTargetException e) { final String msg = "Failed to load skin '" + skinClassName + "' for control " + control; ! final List<CssError> errors = StyleManager.getErrors(); if (errors != null) { ! CssError error = new CssError(msg + " :" + e.getLocalizedMessage()); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg, e.getCause()); } catch (Exception e) { final String msg = "Failed to load skin '" + skinClassName + "' for control " + control; ! final List<CssError> errors = StyleManager.getErrors(); if (errors != null) { ! CssError error = new CssError(msg + " :" + e.getLocalizedMessage()); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg, e); } } --- 729,750 ---- control.skinProperty().set(skinInstance); } } catch (InvocationTargetException e) { final String msg = "Failed to load skin '" + skinClassName + "' for control " + control; ! final List<CssParser.ParseError> errors = StyleManager.getErrors(); if (errors != null) { ! CssParser.ParseError error = new CssParser.ParseError(msg + " :" + e.getLocalizedMessage()); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg, e.getCause()); } catch (Exception e) { final String msg = "Failed to load skin '" + skinClassName + "' for control " + control; ! final List<CssParser.ParseError> errors = StyleManager.getErrors(); if (errors != null) { ! CssParser.ParseError error = new CssParser.ParseError(msg + " :" + e.getLocalizedMessage()); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg, e); } }
*** 861,873 **** skinProperty().set(defaultSkin); super.impl_processCSS(unused); } else { final String msg = "The -fx-skin property has not been defined in CSS for " + this + " and createDefaultSkin() returned null."; ! final List<CssError> errors = StyleManager.getErrors(); if (errors != null) { ! CssError error = new CssError(msg); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg); } } --- 865,877 ---- skinProperty().set(defaultSkin); super.impl_processCSS(unused); } else { final String msg = "The -fx-skin property has not been defined in CSS for " + this + " and createDefaultSkin() returned null."; ! final List<CssParser.ParseError> errors = StyleManager.getErrors(); if (errors != null) { ! CssParser.ParseError error = new CssParser.ParseError(msg); errors.add(error); // RT-19884 } Logging.getControlsLogger().severe(msg); } }