399 * can assume that an interactive GUI is available, so they 400 * can pop up dialog boxes, etc. This will normally return 401 * true in a windowing environment, and will normally return 402 * false in a server environment or if an application is 403 * running as part of a batch job. 404 * 405 * @see Visibility 406 * 407 */ 408 public static boolean isGuiAvailable() { 409 return ThreadGroupContext.getContext().isGuiAvailable(); 410 } 411 412 /** 413 * Used to indicate whether of not we are running in an application 414 * builder environment. 415 * 416 * <p>Note that this method is security checked 417 * and is not available to (for example) untrusted applets. 418 * More specifically, if there is a security manager, 419 * its <code>checkPropertiesAccess</code> 420 * method is called. This could result in a SecurityException. 421 * 422 * @param isDesignTime True if we're in an application builder tool. 423 * @exception SecurityException if a security manager exists and its 424 * <code>checkPropertiesAccess</code> method doesn't allow setting 425 * of system properties. 426 * @see SecurityManager#checkPropertiesAccess 427 */ 428 429 public static void setDesignTime(boolean isDesignTime) 430 throws SecurityException { 431 SecurityManager sm = System.getSecurityManager(); 432 if (sm != null) { 433 sm.checkPropertiesAccess(); 434 } 435 ThreadGroupContext.getContext().setDesignTime(isDesignTime); 436 } 437 438 /** 439 * Used to indicate whether of not we are running in an environment 440 * where GUI interaction is available. 441 * 442 * <p>Note that this method is security checked 443 * and is not available to (for example) untrusted applets. 444 * More specifically, if there is a security manager, 445 * its <code>checkPropertiesAccess</code> 446 * method is called. This could result in a SecurityException. 447 * 448 * @param isGuiAvailable True if GUI interaction is available. 449 * @exception SecurityException if a security manager exists and its 450 * <code>checkPropertiesAccess</code> method doesn't allow setting 451 * of system properties. 452 * @see SecurityManager#checkPropertiesAccess 453 */ 454 455 public static void setGuiAvailable(boolean isGuiAvailable) 456 throws SecurityException { 457 SecurityManager sm = System.getSecurityManager(); 458 if (sm != null) { 459 sm.checkPropertiesAccess(); 460 } 461 ThreadGroupContext.getContext().setGuiAvailable(isGuiAvailable); 462 } 463 } 464 465 /** 466 * This subclass of ObjectInputStream delegates loading of classes to 467 * an existing ClassLoader. 468 */ 469 470 class ObjectInputStreamWithLoader extends ObjectInputStream | 399 * can assume that an interactive GUI is available, so they 400 * can pop up dialog boxes, etc. This will normally return 401 * true in a windowing environment, and will normally return 402 * false in a server environment or if an application is 403 * running as part of a batch job. 404 * 405 * @see Visibility 406 * 407 */ 408 public static boolean isGuiAvailable() { 409 return ThreadGroupContext.getContext().isGuiAvailable(); 410 } 411 412 /** 413 * Used to indicate whether of not we are running in an application 414 * builder environment. 415 * 416 * <p>Note that this method is security checked 417 * and is not available to (for example) untrusted applets. 418 * More specifically, if there is a security manager, 419 * its {@code checkPropertiesAccess} 420 * method is called. This could result in a SecurityException. 421 * 422 * @param isDesignTime True if we're in an application builder tool. 423 * @exception SecurityException if a security manager exists and its 424 * {@code checkPropertiesAccess} method doesn't allow setting 425 * of system properties. 426 * @see SecurityManager#checkPropertiesAccess 427 */ 428 429 public static void setDesignTime(boolean isDesignTime) 430 throws SecurityException { 431 SecurityManager sm = System.getSecurityManager(); 432 if (sm != null) { 433 sm.checkPropertiesAccess(); 434 } 435 ThreadGroupContext.getContext().setDesignTime(isDesignTime); 436 } 437 438 /** 439 * Used to indicate whether of not we are running in an environment 440 * where GUI interaction is available. 441 * 442 * <p>Note that this method is security checked 443 * and is not available to (for example) untrusted applets. 444 * More specifically, if there is a security manager, 445 * its {@code checkPropertiesAccess} 446 * method is called. This could result in a SecurityException. 447 * 448 * @param isGuiAvailable True if GUI interaction is available. 449 * @exception SecurityException if a security manager exists and its 450 * {@code checkPropertiesAccess} method doesn't allow setting 451 * of system properties. 452 * @see SecurityManager#checkPropertiesAccess 453 */ 454 455 public static void setGuiAvailable(boolean isGuiAvailable) 456 throws SecurityException { 457 SecurityManager sm = System.getSecurityManager(); 458 if (sm != null) { 459 sm.checkPropertiesAccess(); 460 } 461 ThreadGroupContext.getContext().setGuiAvailable(isGuiAvailable); 462 } 463 } 464 465 /** 466 * This subclass of ObjectInputStream delegates loading of classes to 467 * an existing ClassLoader. 468 */ 469 470 class ObjectInputStreamWithLoader extends ObjectInputStream |