com.sibvisions.rad.ui
Class ApplicationUtil

java.lang.Object
  extended by com.sibvisions.rad.ui.ApplicationUtil

public final class ApplicationUtil
extends java.lang.Object

The ApplicationUtil is a utility for application launchers.


Method Summary
static boolean configureFrameBounds(ILauncher pLauncher, java.awt.Frame pFrame)
          Configures the bounds for the given frame, if the System property "framebounds" was set.
static IApplication createApplication(ILauncher pLauncher, java.lang.ClassLoader pClassLoader, java.lang.String pClassName)
          Creates an instance of an IApplication.
static IApplication createApplication(ILauncher pLauncher, java.lang.String pClassName)
          Creates an instance of an IApplication.
static XmlNode getConfig(java.lang.String pName)
          Gets the parsed xml configuration.
static java.lang.String getRegistryApplicationName(ILauncher pLauncher)
          Gets the application name out of the launcher.
static java.lang.String getRegistryKey(java.lang.String pApplication, java.lang.String pKey)
          Gets the value for an application specific registry key.
static boolean isLinux()
          Gets whether the operating system is Linux.
static boolean isMacOS()
          Gets whether the operating system is MacOS.
static boolean isWindows()
          Gets whether the operating system is Windows.
static java.lang.String replaceParameter(java.lang.String pValue, ILauncher pLauncher)
          Replaces a parameter placeholder with the desired parameter.
static void setRegistryKey(java.lang.String pApplication, java.lang.String pKey, java.lang.String pValue)
          Sets the value for an application specific registry key.
static java.util.HashMap<java.lang.String,java.lang.String> splitImageProperties(java.lang.String pImageDefinition)
          Splits image properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createApplication

public static IApplication createApplication(ILauncher pLauncher,
                                             java.lang.String pClassName)
                                      throws java.lang.Throwable
Creates an instance of an IApplication.

Parameters:
pLauncher - the launch configuration
pClassName - the full qualified class name of the desired class
Returns:
a new IApplication instance
Throws:
java.lang.Throwable - if the instance can not be created

createApplication

public static IApplication createApplication(ILauncher pLauncher,
                                             java.lang.ClassLoader pClassLoader,
                                             java.lang.String pClassName)
                                      throws java.lang.Throwable
Creates an instance of an IApplication.

Parameters:
pLauncher - the launch configuration
pClassLoader - the class loader
pClassName - the full qualified class name of the desired class
Returns:
a new IApplication instance
Throws:
java.lang.Throwable - if the instance can not be created

getConfig

public static XmlNode getConfig(java.lang.String pName)
                         throws java.lang.Exception
Gets the parsed xml configuration.

Parameters:
pName - the configuration name or path
Returns:
the parsed configuration, or null if the config was not found
Throws:
java.lang.Exception - xml parse error

replaceParameter

public static java.lang.String replaceParameter(java.lang.String pValue,
                                                ILauncher pLauncher)
Replaces a parameter placeholder with the desired parameter. The placeholder looks like the following: [SERVER] The placeholder will be replaced with the value of the SERVER parameter.

Parameters:
pValue - the value of an application parameter
pLauncher - the launcher
Returns:
the value with replaced placeholder(s)

setRegistryKey

public static void setRegistryKey(java.lang.String pApplication,
                                  java.lang.String pKey,
                                  java.lang.String pValue)
Sets the value for an application specific registry key.

Parameters:
pApplication - the application name
pKey - the key to set
pValue - the value to set
Throws:
java.lang.SecurityException - if a SecurityManager is present and denies the registry access
java.lang.RuntimeException - if it's not possible to save the registry key

getRegistryKey

public static java.lang.String getRegistryKey(java.lang.String pApplication,
                                              java.lang.String pKey)
Gets the value for an application specific registry key.

Parameters:
pApplication - the application name
pKey - the key to get
Returns:
the value for the pKey or null if the application or key is not visible
Throws:
java.lang.SecurityException - if a SecurityManager is present and denies the registry access

getRegistryApplicationName

public static java.lang.String getRegistryApplicationName(ILauncher pLauncher)
Gets the application name out of the launcher. If the serverbase param is configured, then the value of this parameter will be the prefix for the application.

Parameters:
pLauncher - the launcher with properties for the application
Returns:
the application name prefixed with the serverbase

configureFrameBounds

public static boolean configureFrameBounds(ILauncher pLauncher,
                                           java.awt.Frame pFrame)
Configures the bounds for the given frame, if the System property "framebounds" was set.

Parameters:
pLauncher - the launcher
pFrame - the frame to change
Returns:
true if bounds were changed, false otherwise

isMacOS

public static boolean isMacOS()
Gets whether the operating system is MacOS.

Returns:
true if MacOS, false otherwise

isLinux

public static boolean isLinux()
Gets whether the operating system is Linux.

Returns:
true if Linux, false otherwise

isWindows

public static boolean isWindows()
Gets whether the operating system is Windows.

Returns:
true if Windows, false otherwise

splitImageProperties

public static java.util.HashMap<java.lang.String,java.lang.String> splitImageProperties(java.lang.String pImageDefinition)
Splits image properties. The definition of an image should be in following format:
imagename;prop1=value1;prop2=value2
. The imagename will be returned as property with the identifier name. If a property with name name was set, it won't be returned.

Parameters:
pImageDefinition - the image definition
Returns:
the parsed properties


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.