< prev index next >

modules/graphics/src/main/java/com/sun/javafx/application/PlatformImpl.java

Print this page
rev 9394 : imported patch 8090585-platform-startup


 116      *
 117      * @param appClass the Application class.
 118      */
 119     public static void setApplicationName(final Class appClass) {
 120         runLater(() -> com.sun.glass.ui.Application.GetApplication().setName(appClass.getName()));
 121     }
 122 
 123     /**
 124      * Return whether or not focus navigation between controls is context-
 125      * sensitive.
 126      * @return true if the context-sensitive algorithm for focus navigation is
 127      * used
 128      */
 129      public static boolean isContextual2DNavigation() {
 130          return contextual2DNavigation;
 131      }
 132 
 133     /**
 134      * This method is invoked typically on the main thread. At this point,
 135      * the JavaFX Application Thread has not been started. Any attempt
 136      * to call startup twice results in an exception.

 137      * @param r
 138      */
 139     public static void startup(final Runnable r) {














 140 
 141         // NOTE: if we ever support re-launching an application and/or
 142         // launching a second application in the same VM/classloader
 143         // this will need to be changed.
 144         if (platformExit.get()) {
 145             throw new IllegalStateException("Platform.exit has been called");
 146         }
 147 
 148         if (initialized.getAndSet(true)) {




 149             // If we've already initialized, just put the runnable on the queue.
 150             runLater(r);
 151             return;
 152         }

 153         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
 154             contextual2DNavigation = Boolean.getBoolean(
 155                     "com.sun.javafx.isContextual2DNavigation");
 156             String s = System.getProperty("com.sun.javafx.twoLevelFocus");
 157             if (s != null) {
 158                 hasTwoLevelFocus = Boolean.valueOf(s);
 159             }
 160             s = System.getProperty("com.sun.javafx.virtualKeyboard");
 161             if (s != null) {
 162                 if (s.equalsIgnoreCase("none")) {
 163                     hasVirtualKeyboard = false;
 164                 } else if (s.equalsIgnoreCase("javafx")) {
 165                     hasVirtualKeyboard = true;
 166                 } else if (s.equalsIgnoreCase("native")) {
 167                     hasVirtualKeyboard = true;
 168                 }
 169             }
 170             s = System.getProperty("com.sun.javafx.touch");
 171             if (s != null) {
 172                 hasTouch = Boolean.valueOf(s);




 116      *
 117      * @param appClass the Application class.
 118      */
 119     public static void setApplicationName(final Class appClass) {
 120         runLater(() -> com.sun.glass.ui.Application.GetApplication().setName(appClass.getName()));
 121     }
 122 
 123     /**
 124      * Return whether or not focus navigation between controls is context-
 125      * sensitive.
 126      * @return true if the context-sensitive algorithm for focus navigation is
 127      * used
 128      */
 129      public static boolean isContextual2DNavigation() {
 130          return contextual2DNavigation;
 131      }
 132 
 133     /**
 134      * This method is invoked typically on the main thread. At this point,
 135      * the JavaFX Application Thread has not been started. Any attempt
 136      * to call startup more than once results in all subsequent calls turning into
 137      * nothing more than a runLater call with the provided Runnable being called.
 138      * @param r
 139      */
 140     public static void startup(final Runnable r) {
 141         startup(r, false);
 142     }
 143 
 144     /**
 145      * This method is invoked typically on the main thread. At this point,
 146      * the JavaFX Application Thread has not been started. If preventDuplicateCalls
 147      * is true, calling this method multiple times will result in an
 148      * IllegalStateException. If it is false, calling this method multiple times
 149      * will result in all subsequent calls turning into
 150      * nothing more than a runLater call with the provided Runnable being called.
 151      * @param r
 152      * @param preventDuplicateCalls
 153      */
 154     public static void startup(final Runnable r, boolean preventDuplicateCalls) {
 155 
 156         // NOTE: if we ever support re-launching an application and/or
 157         // launching a second application in the same VM/classloader
 158         // this will need to be changed.
 159         if (platformExit.get()) {
 160             throw new IllegalStateException("Platform.exit has been called");
 161         }
 162 
 163         if (initialized.getAndSet(true)) {
 164             if (preventDuplicateCalls) {
 165                 throw new IllegalStateException("Toolkit already initialized");
 166             }
 167 
 168             // If we've already initialized, just put the runnable on the queue.
 169             runLater(r);
 170             return;
 171         }
 172 
 173         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
 174             contextual2DNavigation = Boolean.getBoolean(
 175                     "com.sun.javafx.isContextual2DNavigation");
 176             String s = System.getProperty("com.sun.javafx.twoLevelFocus");
 177             if (s != null) {
 178                 hasTwoLevelFocus = Boolean.valueOf(s);
 179             }
 180             s = System.getProperty("com.sun.javafx.virtualKeyboard");
 181             if (s != null) {
 182                 if (s.equalsIgnoreCase("none")) {
 183                     hasVirtualKeyboard = false;
 184                 } else if (s.equalsIgnoreCase("javafx")) {
 185                     hasVirtualKeyboard = true;
 186                 } else if (s.equalsIgnoreCase("native")) {
 187                     hasVirtualKeyboard = true;
 188                 }
 189             }
 190             s = System.getProperty("com.sun.javafx.touch");
 191             if (s != null) {
 192                 hasTouch = Boolean.valueOf(s);


< prev index next >