|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.LaunchBrowser
public class LaunchBrowser
Class LaunchBrowser contains methods for launching browser windows. Application and applet environments are supported. In an application environment, the operating system may be auto-determined and several different versions of the launch command may be attempted, including a user-specified launch command. The following default launch commands are used:
Non-Windows: netscape URL Windows95/98: start "URL" Windows2000/XP: cmd /C "start URL" (for non-file URLs) Windows2000/XP: cmd /C "URL" (for file URLs) Macintosh: /usr/bin/open URLThe order in which the launch commands are attempted is varied such that the one for the operating system in use is attempt first (after any 'setLaunchCommand()' entered). When using "start" or "cmd /C" under Windows operating systems, special characters ("&|()^") are "escaped" by preceding them with the carrot ("^") character.
Field Summary | |
---|---|
protected java.applet.AppletContext |
appletContextObj
|
protected boolean |
browserLaunchEnabledFlag
|
protected static java.lang.String |
CMDCQT_STR
|
protected static java.lang.String |
EMPTY_STR
|
protected java.lang.String |
errorMessage
|
protected java.lang.String[] |
fileCmdPrefixArr
|
protected java.lang.String[] |
fileCmdSuffixArr
|
protected java.lang.String[] |
fileOsPrefixArr
|
protected java.lang.String[] |
fileOsSuffixArr
|
protected int |
firstCmdArrIdx
|
protected java.lang.String[] |
httpCmdPrefixArr
|
protected java.lang.String[] |
httpCmdSuffixArr
|
protected java.lang.String[] |
httpOsPrefixArr
|
protected java.lang.String[] |
httpOsSuffixArr
|
protected java.lang.String |
lastShowURLCmdStr
|
static int |
MACINTOSH
Selection value to indicate Macintosh operating system. |
protected static java.lang.String |
NEED_ESC_CHARS
|
protected static java.lang.String |
NETSCPSP_STR
|
static int |
NON_WINDOWS
Selection value to indicate non-Windows operating system. |
protected static java.lang.String |
osNamePropString
|
protected int |
osSelectVal
|
protected static java.lang.String[] |
osSelStringsArr
|
protected static java.lang.String |
QUOTE_STR
|
protected static java.lang.String |
STARTQT_STR
|
protected static java.lang.String |
STARTSP_STR
|
protected static java.lang.String |
UBOPENSP_STR
|
static int |
WINDOWS_98
Selection value to indicate Windows 98 or earlier OS. |
static int |
WINDOWS_XP
Selection value to indicate Windows XP/2000 operating system. |
Fields inherited from interface com.isti.util.ILaunchBrowser |
---|
NO_ERROR |
Constructor Summary | |
---|---|
LaunchBrowser()
Creates a launch-browser object for an application environment. |
|
LaunchBrowser(java.applet.Applet appletObj)
Creates a launch-browser object for an applet environment. |
|
LaunchBrowser(java.applet.AppletContext appletContextObj)
Creates a launch-browser object for an applet environment. |
|
LaunchBrowser(int selVal)
Creates a launch-browser object for an application environment. |
|
LaunchBrowser(int selVal,
java.lang.String cmdPrefixStr)
Creates a launch-browser object for an application environment. |
|
LaunchBrowser(int selVal,
java.lang.String cmdPrefixStr,
java.lang.String cmdSuffixStr)
Creates a launch-browser object for an application environment. |
|
LaunchBrowser(java.lang.String cmdPrefixStr)
Creates a launch-browser object for an application environment. |
|
LaunchBrowser(java.lang.String cmdPrefixStr,
java.lang.String cmdSuffixStr)
Creates a launch-browser object for an application environment. |
Method Summary | |
---|---|
void |
clearErrorMessage()
Clears the error message string. |
static int |
determineOSType()
Determines the type of operating system in use. |
static java.lang.String |
escSpecialWinChars(java.lang.String urlStr)
Scans the given URL string for special characters ("&|()^") and "escapes" them be preceding each one with the carrot ("^") character. |
boolean |
getErrorFlag()
Returns true if an error was detected. |
java.lang.String |
getErrorMessage()
Returns message string for last error (or 'No error' if none). |
java.lang.String |
getLastShowURLCmdStr()
Returns the last command string used by the 'showURL()' (application mode) or 'showApplicationURL()' method. |
java.lang.String |
getOsNamePropString()
Returns the Operating System name found in the "os.name" system property. |
java.lang.String |
getOSSelectString()
Returns a description string for the operating system select value for this launch browser object ("Non-Windows", "Windows95/98", "Windows2000/XP" or "Macintosh"). |
int |
getOSSelectVal()
Returns the operating system select value for this launch browser object (NON_WINDOWS, WINDOWS_98, WINDOWS_XP or MACINTOSH). |
java.lang.String |
getPrefApplicationLaunchCmd(java.lang.String urlStr)
Returns the "preferred" command that would be used to launch a browser for viewing a non-local-file URL in an application environment. |
java.lang.String |
getPrefApplicationLaunchFileCmd(java.lang.String urlStr)
Returns the "preferred" command that would be used to launch a browser for viewing a local file in an application environment. |
boolean |
isEnabled()
Returns an indicator of whether or not the launching of browser windows is enabled. |
static boolean |
isURLAddress(java.lang.String str)
Returns true if the contents of the given string qualify as a valid URL address; otherwise returns false. |
void |
setEnabled(boolean flgVal)
Enables or disables the launching of browser windows. |
protected void |
setErrorMessage(java.lang.String str)
Enters error message. |
void |
setLaunchCommand(java.lang.String cmdPrefixStr)
Sets up a preferred command used to launch the browser. |
void |
setLaunchCommand(java.lang.String cmdPrefixStr,
boolean addSpaceFlag)
Sets up a preferred command used to launch the browser. |
void |
setLaunchCommand(java.lang.String cmdPrefixStr,
java.lang.String cmdSuffixStr)
Sets up a preferred command used to launch the browser. |
void |
setLaunchCommand(java.lang.String cmdPrefixStr,
java.lang.String cmdSuffixStr,
boolean addSpaceFlag)
Sets up a preferred command used to launch the browser. |
void |
setLaunchCommand(java.lang.String cmdPrefixStr,
java.lang.String cmdSuffixStr,
boolean httpCmdFlag,
boolean fileCmdFlag)
Sets up a preferred command used to launch the browser. |
void |
setLaunchCommand(java.lang.String cmdPrefixStr,
java.lang.String cmdSuffixStr,
boolean addSpaceFlag,
boolean httpCmdFlag,
boolean fileCmdFlag)
Sets up a preferred command used to launch the browser. |
boolean |
setOSType(int selVal)
Selects the operating system for this launch-browser object. |
boolean |
showAppletURL(java.lang.String urlStr)
Displays the given URL address string in a browser window. |
boolean |
showAppletURL(java.lang.String urlStr,
java.lang.String titleStr)
Displays the given URL address string in a separate browser window. |
boolean |
showApplicationURL(java.lang.String urlStr)
Displays the given URL address string in a new browser window. |
boolean |
showURL(java.lang.String urlStr)
Displays the given URL address string in a browser window. |
boolean |
showURL(java.lang.String urlStr,
java.lang.String titleStr)
Displays the given URL address string in a browser window. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NON_WINDOWS
public static final int WINDOWS_98
public static final int WINDOWS_XP
public static final int MACINTOSH
protected static final java.lang.String[] osSelStringsArr
protected final java.applet.AppletContext appletContextObj
protected int osSelectVal
protected static java.lang.String osNamePropString
protected java.lang.String errorMessage
protected static java.lang.String NETSCPSP_STR
protected static java.lang.String UBOPENSP_STR
protected static java.lang.String STARTSP_STR
protected static java.lang.String STARTQT_STR
protected static java.lang.String CMDCQT_STR
protected static java.lang.String EMPTY_STR
protected static java.lang.String QUOTE_STR
protected static java.lang.String NEED_ESC_CHARS
protected final java.lang.String[] httpOsPrefixArr
protected final java.lang.String[] httpOsSuffixArr
protected final java.lang.String[] fileOsPrefixArr
protected final java.lang.String[] fileOsSuffixArr
protected java.lang.String[] httpCmdPrefixArr
protected java.lang.String[] httpCmdSuffixArr
protected java.lang.String[] fileCmdPrefixArr
protected java.lang.String[] fileCmdSuffixArr
protected int firstCmdArrIdx
protected java.lang.String lastShowURLCmdStr
protected boolean browserLaunchEnabledFlag
Constructor Detail |
---|
public LaunchBrowser()
public LaunchBrowser(java.lang.String cmdPrefixStr)
cmdPrefixStr
- the preferred string to put before the URL in
the launch command, or null for none.public LaunchBrowser(java.lang.String cmdPrefixStr, java.lang.String cmdSuffixStr)
cmdPrefixStr
- the preferred string to put before the URL in
the launch command, or null for none.cmdSuffixStr
- the preferred string to put after the URL in
the launch command, or null for none.public LaunchBrowser(int selVal)
selVal
- one of the operating system select values (NON_WINDOWS,
WINDOWS_98, WINDOWS_XP or MACINTOSH).public LaunchBrowser(int selVal, java.lang.String cmdPrefixStr)
selVal
- one of the operating system select values (NON_WINDOWS,
WINDOWS_98, WINDOWS_XP or MACINTOSH).cmdPrefixStr
- the preferred string to put before the URL in
the launch command, or null for none.public LaunchBrowser(int selVal, java.lang.String cmdPrefixStr, java.lang.String cmdSuffixStr)
selVal
- one of the operating system select values (NON_WINDOWS,
WINDOWS_98, WINDOWS_XP or MACINTOSH).cmdPrefixStr
- the preferred string to put before the URL in
the launch command, or null for none.cmdSuffixStr
- the preferred string to put after the URL in
the launch command, or null for none.public LaunchBrowser(java.applet.AppletContext appletContextObj)
appletContextObj
- the 'AppletContext' object to be used.public LaunchBrowser(java.applet.Applet appletObj)
appletObj
- the 'Applet' object containing the 'AppletContext'
object to be used.Method Detail |
---|
public boolean setOSType(int selVal)
selVal
- one of the operating system select values (NON_WINDOWS,
WINDOWS_98, WINDOWS_XP or MACINTOSH).
public void setLaunchCommand(java.lang.String cmdPrefixStr, java.lang.String cmdSuffixStr, boolean addSpaceFlag, boolean httpCmdFlag, boolean fileCmdFlag)
cmdPrefixStr
- the string put before the URL in the launch
command, or null for none.cmdSuffixStr
- the string put after the URL in the launch
command, or null for none.addSpaceFlag
- if true and the command prefix string ends with
an alphanumeric or underscore character then a space is appended
to the prefix.httpCmdFlag
- true to enter the given commands for use with
non-file URLs.fileCmdFlag
- true to enter the given commands for use with
local-file URLs.public void setLaunchCommand(java.lang.String cmdPrefixStr, java.lang.String cmdSuffixStr, boolean addSpaceFlag)
cmdPrefixStr
- the string put before the URL in the launch
command, or null for none.cmdSuffixStr
- the string put after the URL in the launch
command, or null for none.addSpaceFlag
- if true and the command prefix string ends with
an alphanumeric or underscore character then a space is appended
to the prefix.public void setLaunchCommand(java.lang.String cmdPrefixStr, java.lang.String cmdSuffixStr, boolean httpCmdFlag, boolean fileCmdFlag)
cmdPrefixStr
- the string put before the URL in the launch
command, or null for none.cmdSuffixStr
- the string put after the URL in the launch
command, or null for none.httpCmdFlag
- true to enter the given commands for use with
non-file URLs.fileCmdFlag
- true to enter the given commands for use with
local-file URLs.public void setLaunchCommand(java.lang.String cmdPrefixStr, java.lang.String cmdSuffixStr)
cmdPrefixStr
- the string put before the URL in the launch
command, or null for none.cmdSuffixStr
- the string put after the URL in the launch
command, or null for none.public void setLaunchCommand(java.lang.String cmdPrefixStr, boolean addSpaceFlag)
cmdPrefixStr
- the string put before the URL in the launch
command, or null to have the default launch commands be used.addSpaceFlag
- if true and the command prefix string ends with
an alphanumeric or underscore character then a space is appended
to the prefix.public void setLaunchCommand(java.lang.String cmdPrefixStr)
cmdPrefixStr
- the string put before the URL in the launch
command, or null to have the default launch commands be used.public boolean showApplicationURL(java.lang.String urlStr)
urlStr
- a string containing the URL.
public java.lang.String getPrefApplicationLaunchCmd(java.lang.String urlStr)
urlStr
- the URL string to use in the command.
public java.lang.String getPrefApplicationLaunchFileCmd(java.lang.String urlStr)
urlStr
- the URL string to use in the command.
public java.lang.String getLastShowURLCmdStr()
public boolean showAppletURL(java.lang.String urlStr, java.lang.String titleStr)
urlStr
- a string containing the URL.titleStr
- a string used to select a target browser window.
public boolean showAppletURL(java.lang.String urlStr)
urlStr
- a string containing the URL.
public boolean showURL(java.lang.String urlStr, java.lang.String titleStr)
showURL
in interface ILaunchBrowser
urlStr
- a string containing the URL.titleStr
- a string used to select a target browser window.
public boolean showURL(java.lang.String urlStr)
showURL
in interface ILaunchBrowser
urlStr
- a string containing the URL.
public void setEnabled(boolean flgVal)
flgVal
- true to enable, false to disable.public boolean isEnabled()
protected void setErrorMessage(java.lang.String str)
str
- error message string.public boolean getErrorFlag()
public java.lang.String getErrorMessage()
getErrorMessage
in interface ILaunchBrowser
public void clearErrorMessage()
public int getOSSelectVal()
public java.lang.String getOSSelectString()
public java.lang.String getOsNamePropString()
public static int determineOSType()
public static boolean isURLAddress(java.lang.String str)
str
- the string to check.
public static java.lang.String escSpecialWinChars(java.lang.String urlStr)
urlStr
- string to scan.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |