thinkmap.context
Interface IThinkmapContext

All Known Implementing Classes:
DataSourceContext

public interface IThinkmapContext

The IThinkmapContext interface is implemented by objects that host Thinkmap components. Typically, this is either an Applet, Application (on the client side), or a Servlet on the server side.

Version:
$Revision: 1.7 $

Field Summary
static String[] errorLevelNames
           
static int MSG_ERROR
          An error that is serious, but not fatal.
static int MSG_FATAL
          An error where the application can no longer function.
static int MSG_INFO
          An error that is primarily for informative purposes.
static int MSG_WARNING
          An error that is merely a warning and can usually be ignored
 
Method Summary
 void addContextListener(IContextListener l)
          Add a listener to this context.
 Object evalExternal(String code)
          Evaluate the given code in the external envorinment.
 Object getAttribute(String s)
          Returns an object defined by the container in an application specific way.
 String getParameter(String name)
          Returns the value of an initialization parameter that was specified to the container.
 void removeContextListener(IContextListener l)
          Remove a listener from this context.
 void reportError(int level, String message, Throwable e)
          Report an error for the application / applet to display to the user.
 void showDocument(String url, String frame)
          Open the document at the given URL in the given frame.
 

Field Detail

MSG_INFO

static final int MSG_INFO
An error that is primarily for informative purposes.

See Also:
Constant Field Values

MSG_WARNING

static final int MSG_WARNING
An error that is merely a warning and can usually be ignored

See Also:
Constant Field Values

MSG_ERROR

static final int MSG_ERROR
An error that is serious, but not fatal.

See Also:
Constant Field Values

MSG_FATAL

static final int MSG_FATAL
An error where the application can no longer function.

See Also:
Constant Field Values

errorLevelNames

static final String[] errorLevelNames
Method Detail

reportError

void reportError(int level,
                 String message,
                 Throwable e)
Report an error for the application / applet to display to the user.

Parameters:
level - the warning level of the error being reported
message - a human readable message describing the error
e - the Throwable that caused the error (may be null)

getParameter

String getParameter(String name)
Returns the value of an initialization parameter that was specified to the container. For applets, this maps directly to the Applet.getParameter() method. For servlets, this maps to the ServletContext.getInitParameter() merthod. Applications may implement this method in a implementation specific way (for example they may provide access to command line options).

Parameters:
name - the name of the parameter to get
Returns:
the value of that parameter, or null if it does not exist.

getAttribute

Object getAttribute(String s)
Returns an object defined by the container in an application specific way. Components should preferably use the above methods to access resources in a container-independent way. This method is here as a last resort, so that custom plugins and datasources can get access to container data.

Parameters:
name - the name of the attribute to get
Returns:
the value of that attribute, or null if it does not exist.

showDocument

void showDocument(String url,
                  String frame)
                  throws IOException
Open the document at the given URL in the given frame. If this context is not running inside a browser or is unable to display a document, this method will throw an IOException. The url passed can either be relative or absolute. Relative URLs will be resolved relative to the document base (if this is an applet).

Parameters:
url - the URL of the document to show
frame - the name of the frame to populate with the document
Throws:
IOException - if this context is not running inside a browser or is unable to display a document

evalExternal

Object evalExternal(String code)
                    throws Exception
Evaluate the given code in the external envorinment. Usually, this would be a piece of JavaScript code that would be passed to the browser for evaluation.

Parameters:
code - the code to execute in the external environment
Throws:
Exception - if there was an error, or if this context does not support external evaluation.

addContextListener

void addContextListener(IContextListener l)
Add a listener to this context.

Parameters:
l - the listener to add

removeContextListener

void removeContextListener(IContextListener l)
Remove a listener from this context.

Parameters:
l - the listener to remove


Copyright © 2013 Thinkmap, Inc. All Rights Reserved.