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,24 +38,23 @@
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.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 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,10 +417,15 @@
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,13 +688,13 @@
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();
+ final List<CssParser.ParseError> errors = StyleManager.getErrors();
if (errors != null) {
- CssError error = new CssError(msg);
+ CssParser.ParseError error = new CssParser.ParseError(msg);
errors.add(error); // RT-19884
}
Logging.getControlsLogger().severe(msg);
return;
}
@@ -710,13 +714,13 @@
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();
+ final List<CssParser.ParseError> errors = StyleManager.getErrors();
if (errors != null) {
- CssError error = new CssError(msg);
+ CssParser.ParseError error = new CssParser.ParseError(msg);
errors.add(error); // RT-19884
}
Logging.getControlsLogger().severe(msg);
} else {
Skin<?> skinInstance = (Skin<?>) skinConstructor.newInstance(control);
@@ -725,22 +729,22 @@
control.skinProperty().set(skinInstance);
}
} catch (InvocationTargetException e) {
final String msg =
"Failed to load skin '" + skinClassName + "' for control " + control;
- final List<CssError> errors = StyleManager.getErrors();
+ final List<CssParser.ParseError> errors = StyleManager.getErrors();
if (errors != null) {
- CssError error = new CssError(msg + " :" + e.getLocalizedMessage());
+ 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<CssError> errors = StyleManager.getErrors();
+ final List<CssParser.ParseError> errors = StyleManager.getErrors();
if (errors != null) {
- CssError error = new CssError(msg + " :" + e.getLocalizedMessage());
+ CssParser.ParseError error = new CssParser.ParseError(msg + " :" + e.getLocalizedMessage());
errors.add(error); // RT-19884
}
Logging.getControlsLogger().severe(msg, e);
}
}
@@ -861,13 +865,13 @@
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();
+ final List<CssParser.ParseError> errors = StyleManager.getErrors();
if (errors != null) {
- CssError error = new CssError(msg);
+ CssParser.ParseError error = new CssParser.ParseError(msg);
errors.add(error); // RT-19884
}
Logging.getControlsLogger().severe(msg);
}
}