ice.storm
Class StormBase

java.lang.Object
  extended byice.storm.StormBase

public class StormBase
extends Object

The Storm core class. Top-level viewport creation happens ONLY from inside the base. In that case the base uses the callback to ask the application for a new top-level container (new browser window or something).

The base stores a list of top-level viewports (ala HTML frames). Each top-level viewport has a graphical container associated with it.

StormBase also manages the list of currently running pilots and scripters.

Note on URL usage... Unfortunately we have to be quite conservative on using URLs since URL must always specify a protocol supported by Java environment. This is wrong, especially for JMF which can have an arbitrary string for a protocol


Field Summary
static String EXPIRES_LONG
           
static String EXPIRES_STRING
           
static String VERSION
           
 
Constructor Summary
StormBase()
           
StormBase(Session session)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l, String viewportId)
          Add a listener for property change events for a specific viewport (given by viewportId).
 boolean canGoBack(String viewportId)
          Deprecated. Use HistoryManager method instead.
 boolean canGoForward(String viewportId)
          Deprecated. Use HistoryManager method instead.
 void clearContent(String contentType, String viewportName)
          Clears a viewport with specified name and sets up a Pilot for processing data of type 'contentType'.
 void clearVieportContent(String contentType, Viewport viewport)
          Deprecated. Use clearViewportContent(String, Viewport) instead.
 void clearViewportContent(String contentType, Viewport viewport)
          Clears a viewport with specified name and sets up a Pilot for processing data of type 'contentType'.
 void closeViewport(String viewportName)
          Close a top-level viewport.
 boolean configureViewport(Viewport view)
          Initialize new top-level vieport.
 boolean configureViewport(Viewport view, String oldViewId)
          Deprecated. Use configureViewport(Viewport) since the second parameter is never used
 void dispose()
          Dispose of the StormBase object, releasing all resources.
 Viewport findViewportByName(String viewportName)
          Search thru all the viewport hierarchies to find a viewport with given name
 Viewport getActiveViewport()
          Get currently active viewport (normally the html frame that has the focus).
 void getAllViewports(Vector buffer)
          Get all vieports including children ones into `array'
 StormCallback getCallback()
          Deprecated. Use getViewportCallback(...) or getScripterCallback(...) instead
 String getComponentToolkitName()
           
 Container getContainer(Container c)
          Get the default awt container.
 ContentLoaderFactory getContentLoaderFactory()
           
 HistoryManager getHistoryManager()
          Get the history manager
 PilotFactory getPilotFactory()
          Get pilot factory
 Scripter getScripter(String scriptName)
          A Pilot uses this method to get a pointer to a Scripter module.
 ScripterCallback getScripterCallback()
          Get scripter callback
 ScripterFactory getScripterFactory()
          Deprecated.  
 Scripter getScripterForCodeLocation(String location)
          See if location is a script reference like in javascript:alert("Hello!")
 Session getSession()
           
 URLClassLoaderFactory getURLClassLoaderFactory()
          Get ClassLoader factory
 UrlMaster getUrlMaster()
          Deprecated. As of 6.1, no instance of UrlMaster is needed for the contained utility methods. Please use URLResolver.
 ViewportCallback getViewportCallback()
          Get current application callback.
 String getViewportState(String viewportName)
          Get state of a viewport.
 void goBack(String viewportId)
          Deprecated. Use HistoryManager method instead.
 void goForward(String viewportId)
          Deprecated. Use HistoryManager method instead.
 boolean isEventThread()
           
 boolean isMimeTypeEnabled(String mimeType)
          Check whether handling of the given mimeType is enabled
 Viewport newTopLevelViewport(String viewportName)
          Creates a new top level viewport when the location of the new content is not know.
 Viewport newTopLevelViewport(String viewportName, String location)
          Creates a new top level viewport which has knowledge of the content location which will be used by renderContent.
 void reload(String viewportId)
          Deprecated. Use HistoryManager method instead.
 void removePropertyChangeListener(PropertyChangeListener l, String viewportId)
          Remove a propertyChangeListener.
 void renderContent(ContentLoader cl, String viewportName)
          Display content in a viewport.
 void renderContent(String loc, String contentType, String viewportName)
          Display content in a viewport.
 void renderContent(String location, String contentType, Viewport viewport)
           
 void renderContentFully(ContentLoader contentLoader, String viewportName)
          Display content in a viewport.
 void renderStringContent(String content, String contentType, String viewportName)
          Display content in a viewport.
 void renderStringContent(String content, String contentType, Viewport viewport)
          Display content in a explicit viewport object.
 void renderStringContentFully(String content, String contentType, String viewportName)
          Display content in a viewport.
 void renderStringContentFully(String content, String contentType, Viewport viewport)
          Display content in a explicit viewport object.
 void renderVieportContentFully(ContentLoader contentLoader, Viewport viewport)
          Deprecated. Use renderViewportContentFully(ContentLoader, Viewport) instead.
 void renderViewportContent(ContentLoader cl, Viewport view)
          Display content in an explicit viewport object.
 void renderViewportContentFully(ContentLoader contentLoader, Viewport viewport)
          Display content in a viewport.
 void resume()
          Resume the browser
 void runOnEventThreadAndWait(Runnable code, long delay)
           
 void runOnEventThreadLater(Runnable code, long delay)
           
 void setActiveViewport(Viewport view)
          Set the active viewport.
 void setCallback(StormCallback c)
          Deprecated. Use setViewportCallback(...) or setScripterCallback(...) instead
 void setComponentToolkitName(String name)
          Set the name of the component toolkit to be used by pilots.
 void setContainer(Container c, String viewportName)
          Give StormBase a default awt container that will be used for rendering content.
 void setContentLoaderFactory(ContentLoaderFactory contentLoaderFactory)
           
 void setHistoryManager(HistoryManager hm)
          Set the history manager
 void setMimeTypeEnabled(String mimeType, boolean enabled)
          This method can be used to enable/disable support for displaying content of some type(s).
 void setPilotFactory(PilotFactory f)
          Set the factory that will be responsible for loading/instantiation of pilots.
 void setScripterCallback(ScripterCallback c)
          Set scripter subsystem callback to control scripts behavior.
 void setURLClassLoaderFactory(URLClassLoaderFactory f)
          Set the factory that will be responsible for creating url class loaders used by Storm and pilots.
 void setViewportCallback(ViewportCallback c)
          Set application callback.
 void stopLoading(String viewportName)
          Tells the viewport and all its children to stop loading
 void stopViewportLoading(Viewport view)
           
 void suspend()
          Suspend all activities.
static void unload()
          Deprecated. Use dispose() to close all resources used by StormBase
 void unloadAllScripters()
          Unload all scripters so no more script code would be executed and objects created by script code could be garbage collected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION
See Also:
Constant Field Values

EXPIRES_STRING

public static final String EXPIRES_STRING
See Also:
Constant Field Values

EXPIRES_LONG

public static final String EXPIRES_LONG
See Also:
Constant Field Values
Constructor Detail

StormBase

public StormBase()

StormBase

public StormBase(Session session)
Method Detail

getSession

public final Session getSession()

setHistoryManager

public final void setHistoryManager(HistoryManager hm)
Set the history manager

Parameters:
hm - history manager

getHistoryManager

public final HistoryManager getHistoryManager()
Get the history manager

Returns:
current history manager

getScripterFactory

public final ScripterFactory getScripterFactory()
Deprecated.  

Get scripter factory - It is now the same as the pilot factory, so this method is not needed.

Returns:
current scripter factory

setPilotFactory

public final void setPilotFactory(PilotFactory f)
Set the factory that will be responsible for loading/instantiation of pilots.

Parameters:
f - pilot factory.

getPilotFactory

public final PilotFactory getPilotFactory()
Get pilot factory

Returns:
current pilot factory

setURLClassLoaderFactory

public final void setURLClassLoaderFactory(URLClassLoaderFactory f)
Set the factory that will be responsible for creating url class loaders used by Storm and pilots.

Parameters:
f - the factory.

getURLClassLoaderFactory

public final URLClassLoaderFactory getURLClassLoaderFactory()
Get ClassLoader factory

Returns:
the classloader factory.

setComponentToolkitName

public final void setComponentToolkitName(String name)
Set the name of the component toolkit to be used by pilots. This name is an advisory information provided to a pilot at its startup. Basically if your GUI is written in Swing you should call setComponentToolkitName("swing"). When a pilot is loaded, and it supports this gui toolkit it should automatically use it.

Parameters:
name - component toolkit name: 'awt', 'swing' etc.

getComponentToolkitName

public final String getComponentToolkitName()

setContainer

public final void setContainer(Container c,
                               String viewportName)
Give StormBase a default awt container that will be used for rendering content. Note that you can provide the browser either with a container or a callback. If the browser does not have a callback it will not be able to open new windows and all the output will be displayed in this container. This is ok for a help viewer but not for a web browser. The container can be either heavyweight (AWT), lightweight (Swing) or any other type of graphical component as long as it extends java.awt.Container.

Parameters:
c - awt container to diplay the output into
viewportName - name of the viewport that is associated with the container

getContainer

public final Container getContainer(Container c)
Get the default awt container.

Returns:
awt container

setCallback

public final void setCallback(StormCallback c)
Deprecated. Use setViewportCallback(...) or setScripterCallback(...) instead

See Also:
setViewportCallback(ice.storm.ViewportCallback), setScripterCallback(ice.storm.ScripterCallback)

getCallback

public final StormCallback getCallback()
Deprecated. Use getViewportCallback(...) or getScripterCallback(...) instead

See Also:
getViewportCallback(), getScripterCallback()

getViewportCallback

public final ViewportCallback getViewportCallback()
Get current application callback.

Returns:
the callback object

setViewportCallback

public final void setViewportCallback(ViewportCallback c)
Set application callback. StormBase will use it to request some resources (such as openening top-level graphical components) from the main application.

Parameters:
c - the callback object

getScripterCallback

public final ScripterCallback getScripterCallback()
Get scripter callback

Returns:
callback object or null if not set

setScripterCallback

public final void setScripterCallback(ScripterCallback c)
Set scripter subsystem callback to control scripts behavior.

Parameters:
c - callback object

setActiveViewport

public void setActiveViewport(Viewport view)
Set the active viewport. This will replace the existing active viewport with the argument, and publish a VIEWPORT DEACTIVATED event to the currently active viewport, and a VIEWPORT ACTIVATED event to the newly active viewport, if any

Parameters:
view - reference to the viewport becoming active.

getActiveViewport

public Viewport getActiveViewport()
Get currently active viewport (normally the html frame that has the focus).


addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l,
                                      String viewportId)
Add a listener for property change events for a specific viewport (given by viewportId). If viewportId is null the listener will receive events from all viewports.


removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l,
                                         String viewportId)
Remove a propertyChangeListener.


isMimeTypeEnabled

public boolean isMimeTypeEnabled(String mimeType)
Check whether handling of the given mimeType is enabled


setMimeTypeEnabled

public void setMimeTypeEnabled(String mimeType,
                               boolean enabled)
This method can be used to enable/disable support for displaying content of some type(s).


getUrlMaster

public UrlMaster getUrlMaster()
Deprecated. As of 6.1, no instance of UrlMaster is needed for the contained utility methods. Please use URLResolver.


renderContent

public void renderContent(String loc,
                          String contentType,
                          String viewportName)
Display content in a viewport. The call is asynchronous. The StormBase will first try to locate the viewport, if it does not exist it will request a new top-level graphical component from the application and put the viewport into it. It will then locate, load and instantiate the pilot for processing the content.

Parameters:
loc - location (URI) to load the data from
contentType - content type of the data. If this param is non-null its value will override the contentType received during the loading process (for example from a web server).
viewportName - the name of the viewport to render the data into.

renderContent

public void renderContent(String location,
                          String contentType,
                          Viewport viewport)

renderStringContent

public void renderStringContent(String content,
                                String contentType,
                                String viewportName)
Display content in a viewport. The call is asynchronous. The StormBase will first try to locate the viewport, if it does not exist it will request a new top-level graphical component from the application and put the viewport into it. It will then locate, load and instantiate the pilot for processing the content.

Parameters:
content - data to load.
contentType - content type of the data. If this param is non-null its value will override the contentType received during the loading process (for example from a web server).
viewportName - the name of the viewport to render the data into.

renderStringContentFully

public void renderStringContentFully(String content,
                                     String contentType,
                                     String viewportName)
Display content in a viewport. This is a blocking version of the renderContentString() method. The StormBase will first try to locate the viewport, if it does not exist it will request a new top-level graphical component from the application and put the viewport into it. It will then locate, load and instantiate the pilot for processing the content.

Parameters:
content - data to load.
contentType - content type of the data. If this param is non-null its value will override the contentType received during the loading process (for example from a web server).
viewportName - the name of the viewport to render the data into.

renderStringContent

public void renderStringContent(String content,
                                String contentType,
                                Viewport viewport)
Display content in a explicit viewport object. The call is asynchronous. It will then locate, load and instantiate the pilot for processing the content.

Parameters:
content - data to load.
contentType - content type of the data. If this param is non-null its value will override the contentType received during the loading process (for example from a web server).
viewport - viewport to render the data into.

renderStringContentFully

public void renderStringContentFully(String content,
                                     String contentType,
                                     Viewport viewport)
Display content in a explicit viewport object. This is a blocking version of the renderViewportContentString() method. It will then locate, load and instantiate the pilot for processing the content.

Parameters:
content - data to load.
contentType - content type of the data. If this param is non-null its value will override the contentType received during the loading process (for example from a web server).
viewport - viewport to render the data into.

renderContent

public void renderContent(ContentLoader cl,
                          String viewportName)
Display content in a viewport. The call is asynchronous.


renderViewportContent

public void renderViewportContent(ContentLoader cl,
                                  Viewport view)
Display content in an explicit viewport object. The call is asynchronous.


renderContentFully

public void renderContentFully(ContentLoader contentLoader,
                               String viewportName)
Display content in a viewport. This is a blocking version of the renderContent() method.


renderVieportContentFully

public void renderVieportContentFully(ContentLoader contentLoader,
                                      Viewport viewport)
Deprecated. Use renderViewportContentFully(ContentLoader, Viewport) instead.


renderViewportContentFully

public void renderViewportContentFully(ContentLoader contentLoader,
                                       Viewport viewport)
Display content in a viewport. This is a blocking version of the renderViewportContent() method.


clearContent

public void clearContent(String contentType,
                         String viewportName)
Clears a viewport with specified name and sets up a Pilot for processing data of type 'contentType'. The application can use this method to setup/clear a viewport, get hold of the pilot and use that pilot's method to append content programmatically.


clearVieportContent

public void clearVieportContent(String contentType,
                                Viewport viewport)
Deprecated. Use clearViewportContent(String, Viewport) instead.


clearViewportContent

public void clearViewportContent(String contentType,
                                 Viewport viewport)
Clears a viewport with specified name and sets up a Pilot for processing data of type 'contentType'. The application can use this method to setup/clear a viewport, get hold of the pilot and use that pilot's method to append content programmatically.


newTopLevelViewport

public Viewport newTopLevelViewport(String viewportName)
Creates a new top level viewport when the location of the new content is not know.

Parameters:
viewportName - the name of the viewport to render the data into.
Returns:
new top level viewport

newTopLevelViewport

public Viewport newTopLevelViewport(String viewportName,
                                    String location)
Creates a new top level viewport which has knowledge of the content location which will be used by renderContent. The location is sometimes needed by callback to createTopLevelContainer.

Parameters:
viewportName - the name of the viewport to render the data into.
location - (URI) to load the data from
Returns:
new top level viewport
Since:
6.1

reload

public void reload(String viewportId)
Deprecated. Use HistoryManager method instead.

Reload document in a given top-level viewport


goBack

public void goBack(String viewportId)
Deprecated. Use HistoryManager method instead.

Go back to the previous history entry for the given top-level viewport.


canGoBack

public boolean canGoBack(String viewportId)
Deprecated. Use HistoryManager method instead.

Check if it is possible to go back in a given top-level viewport.


goForward

public void goForward(String viewportId)
Deprecated. Use HistoryManager method instead.

Go forward to the next history entry for the given top-level viewport.


canGoForward

public boolean canGoForward(String viewportId)
Deprecated. Use HistoryManager method instead.

Check if it is possible to go back in a given top-level viewport.


configureViewport

public boolean configureViewport(Viewport view,
                                 String oldViewId)
Deprecated. Use configureViewport(Viewport) since the second parameter is never used


configureViewport

public boolean configureViewport(Viewport view)
Initialize new top-level vieport.

Parameters:
view - the new top-level vieport
Returns:
true if the viewport has been successfully configured, false otherwise

findViewportByName

public Viewport findViewportByName(String viewportName)
Search thru all the viewport hierarchies to find a viewport with given name

Parameters:
viewportName - name of the viewport
Returns:
the viewport that has the spe cified name (or id)

getAllViewports

public void getAllViewports(Vector buffer)
Get all vieports including children ones into `array'


closeViewport

public void closeViewport(String viewportName)
Close a top-level viewport. Used from the main application. Note that this works only for a top-level viewport, for all other viewports this methd does nothing.

Parameters:
viewportName - name or id of the top-level viewport to close.

getViewportState

public String getViewportState(String viewportName)
Get state of a viewport. Values:

stopLoading

public void stopLoading(String viewportName)
Tells the viewport and all its children to stop loading


stopViewportLoading

public void stopViewportLoading(Viewport view)

dispose

public void dispose()
Dispose of the StormBase object, releasing all resources.


unload

public static void unload()
Deprecated. Use dispose() to close all resources used by StormBase


suspend

public void suspend()
Suspend all activities.


resume

public void resume()
Resume the browser


getScripterForCodeLocation

public Scripter getScripterForCodeLocation(String location)
See if location is a script reference like in javascript:alert("Hello!")


getScripter

public Scripter getScripter(String scriptName)
A Pilot uses this method to get a pointer to a Scripter module. If the scripter module is not in the system, it is instantiated and all the existing Pilots are asked to create there drivers to expose their info into the scripter. Note that after a scripter has been instantiated, all the new Pilots are asked for their drivers during the creation of Pilots.

Parameters:
scriptName - name of the script language
Returns:
the scripter object that can process the specified scripting language

unloadAllScripters

public void unloadAllScripters()
Unload all scripters so no more script code would be executed and objects created by script code could be garbage collected. Note that this would mark as disabled all ScriptInfo in the current script factory, so to load a scripter again it corresponding ScriptInfo should be enabled.


runOnEventThreadAndWait

public void runOnEventThreadAndWait(Runnable code,
                                    long delay)

runOnEventThreadLater

public void runOnEventThreadLater(Runnable code,
                                  long delay)

isEventThread

public boolean isEventThread()

getContentLoaderFactory

public ContentLoaderFactory getContentLoaderFactory()

setContentLoaderFactory

public void setContentLoaderFactory(ContentLoaderFactory contentLoaderFactory)