org.opensha.sra.gui.components
Interface GuiBeanAPI

All Known Implementing Classes:
BenefitCostBean, StructureDescriptorBean, VulnerabilityBean

public interface GuiBeanAPI

Title: GuiBeanAPI
Description: This interface provides a super flexible method for implementing a Graphical User Interface Java Bean. The idea behind this interface is that under varying situations the same bean functionality might want to be visualized in a variety of ways. For instance, perhaps sometimes you want the bean to appear in a stand-alone frame, while other times you may want the bean to appear as a button that when clicked, can visualize itself in some useful method. The goal of this interface is to allow a bean to be written once and then visualized in any number of ways. While this interface provides a suggestive list of possible visualization names, this in no way should limit a developer to think these are the only ways in which a bean might be visualized. Additionally, not all beans need to be able to visualize themselves in any or all of the methods listed below. Good documentation on the implementing class should clarify which visualizations are supported.

Author:
Eric Martinez

Field Summary
static int APPLET
          Use this to visualize a APPLET instance of the bean
static int APPLICATION
          Use this to visualize a APPLICATION instance of the bean
static int BUTTON
          Use this to visualize a BUTTON instance of the bean
static int EMBED
          Use this to visualize a EMBED instance of the bean
static int MENUOPT
          Use this to visualize a MENUOPT instance of the bean
static int SPLASH
          Use this to visualize a SPLASH instance of the bean
static int WEB
          Use this to visualize a WEB instance of the bean
 
Method Summary
 java.lang.Object getVisualization(int type)
          Creates a visualization that can be used in any application type that returns true with a call to isVisualizationSupported(type).
 java.lang.String getVisualizationClassName(int type)
           
 boolean isVisualizationSupported(int type)
           
 

Field Detail

APPLICATION

static final int APPLICATION
Use this to visualize a APPLICATION instance of the bean

See Also:
Constant Field Values

APPLET

static final int APPLET
Use this to visualize a APPLET instance of the bean

See Also:
Constant Field Values

WEB

static final int WEB
Use this to visualize a WEB instance of the bean

See Also:
Constant Field Values

BUTTON

static final int BUTTON
Use this to visualize a BUTTON instance of the bean

See Also:
Constant Field Values

EMBED

static final int EMBED
Use this to visualize a EMBED instance of the bean

See Also:
Constant Field Values

SPLASH

static final int SPLASH
Use this to visualize a SPLASH instance of the bean

See Also:
Constant Field Values

MENUOPT

static final int MENUOPT
Use this to visualize a MENUOPT instance of the bean

See Also:
Constant Field Values
Method Detail

getVisualization

java.lang.Object getVisualization(int type)
                                  throws java.lang.IllegalArgumentException
Creates a visualization that can be used in any application type that returns true with a call to isVisualizationSupported(type).

Parameters:
type - An int defining the type of application visualization desired.
Returns:
The visualization of the GuiBean. This might be a JComponent in the case of an applet/application, but might just be an HTML String in the case of a web application. Implementation can vary greatly.
Throws:
java.lang.IllegalArgumentException - If isVisualizationSupported(type) returns false.

getVisualizationClassName

java.lang.String getVisualizationClassName(int type)
Parameters:
type - The type of visualization desired.
Returns:
The fully qualified class name of the visualization object returned by getVisualization. If the given type is not supported, then null is returned.

isVisualizationSupported

boolean isVisualizationSupported(int type)
Parameters:
type - The type of application the visualization is desired for.
Returns:
True if the visualization type is available, false otherwise.