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

Print this page

    rev 4839 : RT-2529: Locale specific runtime errors (Turkish)

      41 import javafx.geometry.HPos;
      42 import javafx.geometry.Point2D;
      43 import javafx.geometry.Rectangle2D;
      44 import javafx.geometry.VPos;
      45 import javafx.scene.Node;
      46 import javafx.scene.Scene;
      47 import javafx.scene.input.InputEvent;
      48 import javafx.scene.input.KeyCode;
      49 import javafx.scene.input.KeyEvent;
      50 import javafx.scene.input.MouseEvent;
      51 import javafx.scene.layout.Region;
      52 import javafx.scene.text.Text;
      53 import javafx.stage.Popup;
      54 import javafx.util.Duration;
      55 import java.io.BufferedReader;
      56 import java.io.InputStream;
      57 import java.io.InputStreamReader;
      58 import java.util.ArrayList;
      59 import java.util.Collections;
      60 import java.util.List;

      61 import com.sun.javafx.css.StyleManager;
      62 import com.sun.javafx.scene.control.behavior.BehaviorBase;
      63 import static javafx.scene.input.MouseEvent.MOUSE_PRESSED;
      64 import static javafx.scene.input.TouchEvent.TOUCH_PRESSED;
      65 import static javafx.scene.layout.Region.USE_PREF_SIZE;
      66
      67
      68 public class FXVKSkin extends BehaviorSkinBase<FXVK, BehaviorBase<FXVK>> {
      69
      70     private static final int GAP = 6;
      71
      72     private List<List<Key>> board;
      73     private int numCols;
      74
      75     private boolean capsDown = false;
      76     private boolean shiftDown = false;
      77     private boolean isSymbol = false;
      78     long lastTime = -1L;
      79
      80     void clearShift() {
     207                 }
     208             };
     209         }
     210         attachedNode.addEventHandler(TOUCH_PRESSED, unHideEventHandler);
     211         attachedNode.addEventHandler(MOUSE_PRESSED, unHideEventHandler);
     212     }
     213
     214     private void unRegisterUnhideHandler(Node node) {
     215         if (unHideEventHandler != null) {
     216             node.removeEventHandler(TOUCH_PRESSED, unHideEventHandler);
     217             node.removeEventHandler(MOUSE_PRESSED, unHideEventHandler);
     218         }
     219     }
     220
     221     private void updateKeyboardType() {
     222         String oldType = vkType;
     223         int typeIndex = 0;
     224         Object typeValue = attachedNode.getProperties().get(FXVK.VK_TYPE_PROP_KEY);
     225         String typeStr = null;
     226         if (typeValue instanceof String) {
     227             typeStr = ((String)typeValue).toLowerCase();
     228         }
     229         vkType = (typeStr != null ? typeStr : "text");
     230
     231         //VK type changed, rebuild
     232         if ( oldType == null || !vkType.equals(oldType) ) {
     233             rebuild();
     234         }
     235     }
     236
     237     public FXVKSkin(final FXVK fxvk) {
     238         super(fxvk, new BehaviorBase<>(fxvk, Collections.EMPTY_LIST));
     239         this.fxvk = fxvk;
     240
     241         StyleManager.getInstance().addUserAgentStylesheet("com/sun/javafx/scene/control/skin/caspian/fxvk.css");
     242
     243         fxvk.setFocusTraversable(false);
     244
     245         if (fxvk != secondaryVK) {
     246             //init secondary VK delay animation
     247             if (secondaryVKDelay == null) {
      41 import javafx.geometry.HPos;
      42 import javafx.geometry.Point2D;
      43 import javafx.geometry.Rectangle2D;
      44 import javafx.geometry.VPos;
      45 import javafx.scene.Node;
      46 import javafx.scene.Scene;
      47 import javafx.scene.input.InputEvent;
      48 import javafx.scene.input.KeyCode;
      49 import javafx.scene.input.KeyEvent;
      50 import javafx.scene.input.MouseEvent;
      51 import javafx.scene.layout.Region;
      52 import javafx.scene.text.Text;
      53 import javafx.stage.Popup;
      54 import javafx.util.Duration;
      55 import java.io.BufferedReader;
      56 import java.io.InputStream;
      57 import java.io.InputStreamReader;
      58 import java.util.ArrayList;
      59 import java.util.Collections;
      60 import java.util.List;
      61 import java.util.Locale;
      62 import com.sun.javafx.css.StyleManager;
      63 import com.sun.javafx.scene.control.behavior.BehaviorBase;
      64 import static javafx.scene.input.MouseEvent.MOUSE_PRESSED;
      65 import static javafx.scene.input.TouchEvent.TOUCH_PRESSED;
      66 import static javafx.scene.layout.Region.USE_PREF_SIZE;
      67
      68
      69 public class FXVKSkin extends BehaviorSkinBase<FXVK, BehaviorBase<FXVK>> {
      70
      71     private static final int GAP = 6;
      72
      73     private List<List<Key>> board;
      74     private int numCols;
      75
      76     private boolean capsDown = false;
      77     private boolean shiftDown = false;
      78     private boolean isSymbol = false;
      79     long lastTime = -1L;
      80
      81     void clearShift() {
     208                 }
     209             };
     210         }
     211         attachedNode.addEventHandler(TOUCH_PRESSED, unHideEventHandler);
     212         attachedNode.addEventHandler(MOUSE_PRESSED, unHideEventHandler);
     213     }
     214
     215     private void unRegisterUnhideHandler(Node node) {
     216         if (unHideEventHandler != null) {
     217             node.removeEventHandler(TOUCH_PRESSED, unHideEventHandler);
     218             node.removeEventHandler(MOUSE_PRESSED, unHideEventHandler);
     219         }
     220     }
     221
     222     private void updateKeyboardType() {
     223         String oldType = vkType;
     224         int typeIndex = 0;
     225         Object typeValue = attachedNode.getProperties().get(FXVK.VK_TYPE_PROP_KEY);
     226         String typeStr = null;
     227         if (typeValue instanceof String) {
     228             typeStr = ((String)typeValue).toLowerCase(Locale.ROOT);
     229         }
     230         vkType = (typeStr != null ? typeStr : "text");
     231
     232         //VK type changed, rebuild
     233         if ( oldType == null || !vkType.equals(oldType) ) {
     234             rebuild();
     235         }
     236     }
     237
     238     public FXVKSkin(final FXVK fxvk) {
     239         super(fxvk, new BehaviorBase<>(fxvk, Collections.EMPTY_LIST));
     240         this.fxvk = fxvk;
     241
     242         StyleManager.getInstance().addUserAgentStylesheet("com/sun/javafx/scene/control/skin/caspian/fxvk.css");
     243
     244         fxvk.setFocusTraversable(false);
     245
     246         if (fxvk != secondaryVK) {
     247             //init secondary VK delay animation
     248             if (secondaryVKDelay == null) {