modules/controls/src/main/java/com/sun/javafx/scene/control/skin/FXVK.java
Print this page
rev 9240 : 8076423: JEP 253: Prepare JavaFX UI Controls & CSS APIs for Modularization
*** 23,32 ****
--- 23,34 ----
* questions.
*/
package com.sun.javafx.scene.control.skin;
+ import javafx.application.ConditionalFeature;
+ import javafx.application.Platform;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ObjectPropertyBase;
import javafx.beans.property.SimpleObjectProperty;
import javafx.geometry.NodeOrientation;
import javafx.scene.Node;
*** 51,61 ****
public final void setOnAction(EventHandler<KeyEvent> value) { onAction.set(value); }
public final EventHandler<KeyEvent> getOnAction() { return onAction.get(); }
public final ObjectProperty<EventHandler<KeyEvent>> onActionProperty() { return onAction; }
! final static String[] VK_TYPE_NAMES = new String[] { "text", "numeric", "url", "email" };
public final static String VK_TYPE_PROP_KEY = "vkType";
String[] chars;
public FXVK() {
--- 53,63 ----
public final void setOnAction(EventHandler<KeyEvent> value) { onAction.set(value); }
public final EventHandler<KeyEvent> getOnAction() { return onAction.get(); }
public final ObjectProperty<EventHandler<KeyEvent>> onActionProperty() { return onAction; }
! public final static String[] VK_TYPE_NAMES = new String[] { "text", "numeric", "url", "email" };
public final static String VK_TYPE_PROP_KEY = "vkType";
String[] chars;
public FXVK() {
*** 104,113 ****
--- 106,139 ----
if (vk != null) {
vk.setAttachedNode(null);
}
}
+ private final static boolean IS_FXVK_SUPPORTED = Platform.isSupported(ConditionalFeature.VIRTUAL_KEYBOARD);
+ private static boolean USE_FXVK = IS_FXVK_SUPPORTED;
+
+ public static boolean useFXVK() {
+ return USE_FXVK;
+ }
+
+ public static void toggleUseVK(TextInputControl textInput) {
+ Integer vkType = (Integer)textInput.getProperties().get(VK_TYPE_PROP_KEY);
+ if (vkType == null) {
+ vkType = -1;
+ }
+ vkType++;
+ if (vkType < 4) {
+ USE_FXVK = true;
+ textInput.getProperties().put(VK_TYPE_PROP_KEY, vkType);
+ attach(textInput);
+ } else {
+ detach();
+ textInput.getProperties().put(VK_TYPE_PROP_KEY, null);
+ USE_FXVK = false;
+ }
+ }
+
/***************************************************************************
* *
* Methods *
* *
**************************************************************************/