public class SoyLatteBrowserLaunching extends java.lang.Object implements IBrowserLaunching
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONFIGFILE_SOYLATTE
config file for linux/unix
|
protected AbstractLogger |
logger |
BROWSER_DEFAULT, BROWSER_SYSTEM_PROPERTY, PROP_KEY_BROWSER_PREFIX, PROP_KEY_DELIMITER, PROTOCOL_FILE, PROTOCOL_HTTP, PROTOCOL_MAILTO, WINDOWS_BROWSER_DISC_POLICY_DISK, WINDOWS_BROWSER_DISC_POLICY_PROPERTY, WINDOWS_BROWSER_DISC_POLICY_REGISTRY| Constructor and Description |
|---|
SoyLatteBrowserLaunching(AbstractLogger logger)
Sets the logger and config file name.
|
| Modifier and Type | Method and Description |
|---|---|
protected SoyLatteBrowser |
getBrowser(java.lang.String key)
Provides access the browsers map for extending classes.
|
java.util.List |
getBrowserList()
Returns a list of browsers to be used for browser
targetting.
|
boolean |
getNewWindowPolicy()
Returns the policy used for opening a url in a browser.
|
void |
initialize()
Uses the which command to find out which browsers are available.
|
void |
openUrl(java.util.List browsers,
java.lang.String urlString)
Allows user to target several browsers.
|
void |
openUrl(java.lang.String urlString)
Opens a url in one of the available browsers.
|
void |
openUrl(java.lang.String browser,
java.lang.String urlString)
Opens a url in the specified browser.
|
protected boolean |
openUrlWithBrowser(SoyLatteBrowser slBrowser,
java.lang.String urlString)
Attempts to open a url with the specified browser.
|
void |
setBrowserEventCallBack(IBrowserEventCallBack callback)
Registers the browser event call back with the launcher object.
|
void |
setNewWindowPolicy(boolean forceNewWindow)
Sets the policy used for opening a url in a browser.
|
public static final java.lang.String CONFIGFILE_SOYLATTE
protected final AbstractLogger logger
public SoyLatteBrowserLaunching(AbstractLogger logger)
logger - AbstractLoggerconfigFile - Stringprotected SoyLatteBrowser getBrowser(java.lang.String key)
key - Stringprotected boolean openUrlWithBrowser(SoyLatteBrowser slBrowser, java.lang.String urlString) throws BrowserLaunchingExecutionException
slBrowser - SoyLatteBrowserurlString - StringBrowserLaunchingExecutionExceptionpublic void setBrowserEventCallBack(IBrowserEventCallBack callback)
setBrowserEventCallBack in interface IBrowserLaunchingcallback - IBrowserEventCallBackpublic void initialize()
throws BrowserLaunchingInitializingException
initialize in interface IBrowserLaunchingBrowserLaunchingInitializingExceptionpublic void openUrl(java.lang.String urlString)
throws UnsupportedOperatingSystemException,
BrowserLaunchingExecutionException,
BrowserLaunchingInitializingException
openUrl in interface IBrowserLaunchingurlString - StringBrowserLaunchingExecutionExceptionUnsupportedOperatingSystemExceptionBrowserLaunchingInitializingExceptionpublic void openUrl(java.lang.String browser,
java.lang.String urlString)
throws UnsupportedOperatingSystemException,
BrowserLaunchingExecutionException,
BrowserLaunchingInitializingException
openUrl in interface IBrowserLaunchingbrowser - StringurlString - StringUnsupportedOperatingSystemExceptionBrowserLaunchingExecutionExceptionBrowserLaunchingInitializingExceptionpublic void openUrl(java.util.List browsers,
java.lang.String urlString)
throws UnsupportedOperatingSystemException,
BrowserLaunchingExecutionException,
BrowserLaunchingInitializingException
getBrowserList method.
The browsers from the list will be tried in order (first to last) until one of the calls succeeds. If all the calls to the requested browsers fail, the code will fail over to the default browser.
openUrl in interface IBrowserLaunchingbrowsers - ListurlString - StringUnsupportedOperatingSystemExceptionBrowserLaunchingExecutionExceptionBrowserLaunchingInitializingExceptionpublic java.util.List getBrowserList()
getBrowserList in interface IBrowserLaunchingpublic boolean getNewWindowPolicy()
If the policy is true, an attempt will be made to force the url to be opened in a new instance (window) of the browser.
If the policy is false, the url may open in a new window or a new tab.
Most browsers on Unix/Linux systems have command line options to support this feature.
getNewWindowPolicy in interface IBrowserLaunchingpublic void setNewWindowPolicy(boolean forceNewWindow)
setNewWindowPolicy in interface IBrowserLaunchingforceNewWindow - boolean