ice.ri.enhancedawt.browser
Class Main

java.lang.Object
  extended byice.ri.enhancedawt.browser.Main
All Implemented Interfaces:
IBGestureListener, ScripterCallback, ViewportCallback

public class Main
extends Object
implements IBGestureListener, ViewportCallback, ScripterCallback

ICEbrowser Enhanced AWT Reference Implementation


Field Summary
 String cancelText
           
static StormBase m_base
          The StormBase member is the main access point of the browser
 String okText
           
 
Constructor Summary
Main()
          Constructor - no arguments
 
Method Summary
 void activateFrame()
          The frame setup method for command line startup.
 boolean allowScriptClose(Viewport vp, boolean openedByScript)
          Interface methods from ScripterCallback
 Container createTopLevelContainer(Viewport viewport)
          Interface method from ViewportCallback
 void destroy()
          The ApplicationPlugin destroy method
 void disposeTopLevelContainer(Viewport viewport)
          Interface method from ViewportCallback
 ConfigurationManager getConfigManager()
           
 long getMaxScriptRunningTime()
          Maximum time in milliseconds for script to run on the event thread.
 Preferences getPreferences()
           
 String[] getTopLevelIds()
          Gets the top level viewport ids.
 void handleGesture(String viewportId, Gesture g)
          The IBGestureListener impl
 void init()
          The ApplicationPlugin init() method
 void init(StormBase base)
          Interface method from ViewportCallback
 boolean interruptLongRunningScript(Viewport vp, long scriptRunningTime)
          Notify about long running script that blocks user input.
static void main(String[] args)
          The static main method.
 void parseArgs(String[] args)
          Parses the args for GUI information.
 void processViewportMessage(Viewport view, String messageName, Object addArg, Object value)
          Interface method from ViewportCallback
 void reportScriptError(Viewport vp, boolean justWarning, String errorMessage, String url, int lineNumber, String lineSource, int lineOffset)
          Notify about errors during script execution.
 void scriptAlert(Viewport vp, String msg)
          Implement script alert method
 boolean scriptConfirm(Viewport vp, String msg)
          Implement script confirm method
 void scriptPrint(Viewport view)
          Implement script print method
 String scriptPrompt(Viewport vp, String msg, String defVal)
          Implement script prompt method
 void setLoadImages(boolean doLoad)
          Set whether the ice browser should load images or not.
 void start()
          The ApplicationPlugin start method
 void stop()
          The ApplicationPlugin stop method
 void topLevelWindowClosing(String viewportId)
          The GUI calls this method when a top level window is closing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_base

public static StormBase m_base
The StormBase member is the main access point of the browser


okText

public String okText

cancelText

public String cancelText
Constructor Detail

Main

public Main()
Constructor - no arguments

Method Detail

init

public void init()
The ApplicationPlugin init() method


getConfigManager

public ConfigurationManager getConfigManager()

getPreferences

public Preferences getPreferences()

start

public void start()
The ApplicationPlugin start method


stop

public void stop()
The ApplicationPlugin stop method


destroy

public void destroy()
The ApplicationPlugin destroy method


topLevelWindowClosing

public void topLevelWindowClosing(String viewportId)
The GUI calls this method when a top level window is closing

Parameters:
viewportId - the viewport id representing the window that is closing.

getTopLevelIds

public String[] getTopLevelIds()
Gets the top level viewport ids.

Returns:
Stringp[] of all top level viewport ids.

setLoadImages

public void setLoadImages(boolean doLoad)
Set whether the ice browser should load images or not.

Parameters:
doLoad - boolean to load images or not.

handleGesture

public void handleGesture(String viewportId,
                          Gesture g)
The IBGestureListener impl

Specified by:
handleGesture in interface IBGestureListener

init

public void init(StormBase base)
Interface method from ViewportCallback

Specified by:
init in interface ViewportCallback

createTopLevelContainer

public Container createTopLevelContainer(Viewport viewport)
Interface method from ViewportCallback

Specified by:
createTopLevelContainer in interface ViewportCallback
Parameters:
viewport - the viewport that will be associated with this awt container. The viewport object may contain some parameters describing how the new browser window should look like (for example, from window.open() in JavaScript)
Returns:
an awt container (light or heavy) that the browser can use, or null if the window should not be popped up.

disposeTopLevelContainer

public void disposeTopLevelContainer(Viewport viewport)
Interface method from ViewportCallback

Specified by:
disposeTopLevelContainer in interface ViewportCallback

processViewportMessage

public void processViewportMessage(Viewport view,
                                   String messageName,
                                   Object addArg,
                                   Object value)
Interface method from ViewportCallback

Specified by:
processViewportMessage in interface ViewportCallback

allowScriptClose

public boolean allowScriptClose(Viewport vp,
                                boolean openedByScript)
Interface methods from ScripterCallback

Specified by:
allowScriptClose in interface ScripterCallback
Parameters:
openedByScript - specify whether viewport was created by script.
Returns:
true to proceed with window closing or false to ignore close call. Usage example that allows script to close window only if it was created from script (which is default behavior if script callback was not registered):
        public boolean allowScriptClose(Viewport view, boolean openedByScript) {
                return openedByScript;
        }

getMaxScriptRunningTime

public long getMaxScriptRunningTime()
Description copied from interface: ScripterCallback
Maximum time in milliseconds for script to run on the event thread. When script code is executed on the application event thread which is the case for DOM event handlers, it blocks a user input until it finishes. This method allows to specify a time period after which the script can be terminated.

Specified by:
getMaxScriptRunningTime in interface ScripterCallback
Returns:
time in milliseconds before the script subsystem calls interruptLongRunningScript. If returns 0, monitoring of long running scripts would be disabled.
See Also:
ScripterCallback.interruptLongRunningScript(ice.storm.Viewport, long)

interruptLongRunningScript

public boolean interruptLongRunningScript(Viewport vp,
                                          long scriptRunningTime)
Description copied from interface: ScripterCallback
Notify about long running script that blocks user input. This method is called when a script that runs on the application event thread exceeds time specified by getMaxScriptRunningTime. The script would be terminated if the method returns true. A possible way to implement the method is to present to a user a dialog asking to terminate or continue the long running script.

Specified by:
interruptLongRunningScript in interface ScripterCallback
Parameters:
vp - Viewport with code for long running script
scriptRunningTime - Total time in milliseconds since scrip was started
Returns:
true to terminate the script, false to allow it to continue
See Also:
ScripterCallback.getMaxScriptRunningTime()

reportScriptError

public void reportScriptError(Viewport vp,
                              boolean justWarning,
                              String errorMessage,
                              String url,
                              int lineNumber,
                              String lineSource,
                              int lineOffset)
Description copied from interface: ScripterCallback
Notify about errors during script execution.

Specified by:
reportScriptError in interface ScripterCallback
Parameters:
vp - Viewport containing error triggering script
justWarning - True if the reported problem does not prevent father execution of the script.
errorMessage - Text of error message
url - Point to url containing error triggering script code
lineNumber - If non-negative, gives number for line with error
lineSource - If not null, contains error line text
lineOffset - Offset in characters from line start for error-triggering code

scriptAlert

public void scriptAlert(Viewport vp,
                        String msg)
Description copied from interface: ScripterCallback
Implement script alert method

Specified by:
scriptAlert in interface ScripterCallback

scriptConfirm

public boolean scriptConfirm(Viewport vp,
                             String msg)
Description copied from interface: ScripterCallback
Implement script confirm method

Specified by:
scriptConfirm in interface ScripterCallback

scriptPrompt

public String scriptPrompt(Viewport vp,
                           String msg,
                           String defVal)
Description copied from interface: ScripterCallback
Implement script prompt method

Specified by:
scriptPrompt in interface ScripterCallback

scriptPrint

public void scriptPrint(Viewport view)
Description copied from interface: ScripterCallback
Implement script print method

Specified by:
scriptPrint in interface ScripterCallback

main

public static void main(String[] args)
The static main method. ENTRY POINT for standalone.

Parameters:
args -

parseArgs

public void parseArgs(String[] args)
Parses the args for GUI information.

Parameters:
args - A string array of arguments to parse.

activateFrame

public void activateFrame()
The frame setup method for command line startup.