org.ascape.runtime.swing
Class DesktopEnvironment

java.lang.Object
  extended by org.ascape.model.event.DefaultScapeListener
      extended by org.ascape.runtime.RuntimeEnvironment
          extended by org.ascape.runtime.AbstractUIEnvironment
              extended by org.ascape.runtime.swing.SwingEnvironment
                  extended by org.ascape.runtime.swing.DesktopEnvironment
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, ScapeListener, HasName

public class DesktopEnvironment
extends SwingEnvironment

Suppots all user environment ascapet of a running ascape app in a vm, including user frame, etc.

Since:
3.0
Version:
3.0
Author:
Miles Parker
See Also:
Serialized Form

Field Summary
protected static java.awt.Color ACCENT_COLOR
          The Constant ACCENT_COLOR.
static int APPLET_VIEW_MODE
          Symbol indicating the manager is supporting an applet view.
protected static java.awt.Color BUTTON_ROLLOVER_COLOR
          The Constant BUTTON_ROLLOVER_COLOR.
static int CLASSIC_VIEW_MODE
          Symbol indicating the manager is supporting a swing external frames view, using javax.swing.JFrame;
static DesktopEnvironment DEFAULT_ENVIRONMENT
           
static int GRID_MULTIVIEW_LABEL_MODE
          Symbol indicating that views added should be put into a grid layout, with a name appearing above each panel..
static int GRID_MULTIVIEW_MODE
          Symbol indicating that views added should be put into a grid layout.
static int MDI_VIEW_MODE
          Symbol indicating the manager is supporting a swing internal frames view, using javax.swing.JIntenralFrame; [Internal frames are not quite ready for prime time.]
static int NON_SWING_VIEW_MODE
          Symbol indicating the manager is supporting a non-swing external frames view, using java.awt.Frame;
static int TABBED_MULTIVIEW_MODE
          Symbol indicating that views added should be put into a tabbed layout.
 
Fields inherited from class org.ascape.runtime.swing.SwingEnvironment
controlBarView, modelNameField
 
Fields inherited from class org.ascape.runtime.AbstractUIEnvironment
DEBUG_RUNTIME_MODE, RELEASE_RUNTIME_MODE, runtimeMode
 
Fields inherited from class org.ascape.model.event.DefaultScapeListener
listeningToScape, name, scape
 
Constructor Summary
DesktopEnvironment()
          Instantiates a new user environment.
 
Method Summary
static javax.swing.JButton addToolBarButton(javax.swing.JToolBar toolBar)
          A helper method to add a button to the provided toolbar for the specified action.
static javax.swing.JButton addToolBarButton(javax.swing.JToolBar toolBar, javax.swing.Action action)
          A helper method to add a button to the provided toolbar for the specified action.
static void checkForLicenseAgreement()
          Check for license agreement.
 void createFrame(ComponentView[] views)
          Creates the frame.
protected static javax.swing.JLabel createLabel()
          Creates the label.
static javax.swing.JLabel createLabel(int width)
          Creates the label.
static javax.swing.JToolBar createToolbar()
          Creates the toolbar.
static void displayAboutDialog(Scape scape)
          Displays a standard about dialog.
 void environmentQuiting(ScapeEvent scapeEvent)
          Setup up a basic interactive controlBar time userEnvironment for a model application.
 ModelApplet getApplet()
          If model is running in an applet vm context, returns the applet.
 javax.swing.JPanel getAppletModelPanel()
          If model is running in an applet vm context, returns the applet.
static javax.swing.ImageIcon getIcon(java.lang.String imageName)
          Utility method to return an image icon.
static java.awt.Image getImage(java.lang.String string)
          Utility method to return an image resource as specified according to the rules of Class.getResource.
static javax.swing.border.Border getInfoAreaBorder()
          Gets the info area border.
 int getMultiViewMode()
          Returns the multi view mode that will be used when adding any new windows.
 java.beans.PropertyChangeSupport getPropertySupportForObject(java.lang.Object object)
          Returns PropertyChangeSupport for the object provided.
 AgentSelectionManager getSelectionManager()
          Gets the selection manager.
 UserFrame getUserFrame()
          Gets the user frame.
 int getViewMode()
          Returns the view viewMode being used.
 boolean isFullScreen()
          Checks if is full screen.
 boolean isInApplet()
          Are we in an applet vm context? returns true if this scape is viewed in an applet, false otherwise.
 void placeRandomLocation(java.awt.Container frameImp)
          Places the window in a random location.
protected  void registerViewFrame(ViewFrameBridge v)
          Register view frame.
static void removeToolBarButton(javax.swing.JToolBar toolbar, javax.swing.Action action)
          A helper method to remove a button from the provided toolbar for the specified action.
 void scapeAdded(ScapeEvent scapeEvent)
          When a scape is added add any persiten views to it and set frame title.
 void scapeRemoved(ScapeEvent scapeEvent)
          When a scape is removed reset frame title.
 void setApplet(java.lang.Object _applet, Scape parent)
          Sets the applet scape views are to be displayed within, indicating that we are in an applet vm context.
 void setFullScreen(boolean fullScreen)
          Sets the full screen.
 void setMultiViewMode(int _multiViewMode)
          Sets the multi view to use when adding a new window.
protected static void setupLabel(javax.swing.JLabel label)
          Sets the up label.
 void setUserFrame(UserFrame userFrame)
          Sets the user frame.
 void setViewMode(int _viewMode)
          Sets the viewMode to use.
 boolean supportsSwing()
          Returns the view viewMode being used.
 
Methods inherited from class org.ascape.runtime.swing.SwingEnvironment
addView, addViews, createFrame, getAllFrames, getControlBarView, getRootPane, openDialog, removeView, setControlBarView, setRootPane, showErrorDialog, showSplashScreenNotice
 
Methods inherited from class org.ascape.runtime.AbstractUIEnvironment
getCustomizer, getRuntimeMode, isRedirectConsole, isShowNavigator, setCustomizer, setRedirectConsole, setRuntimeMode, setShowNavigator
 
Methods inherited from class org.ascape.runtime.RuntimeEnvironment
addView, addViews, exit, getConsole, getEnvironmentViews, quit, removeViews, setConsole
 
Methods inherited from class org.ascape.model.event.DefaultScapeListener
clone, getName, getScape, isGraphic, isLifeOfScape, isNotifyScapeAutomatically, notifyScapeUpdated, scapeClosing, scapeDeserialized, scapeInitialized, scapeIterated, scapeNotification, scapeSetup, scapeStarted, scapeStopped, setName, setNotifyScapeAutomatically, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_ENVIRONMENT

public static DesktopEnvironment DEFAULT_ENVIRONMENT

APPLET_VIEW_MODE

public static final int APPLET_VIEW_MODE
Symbol indicating the manager is supporting an applet view.

See Also:
Constant Field Values

CLASSIC_VIEW_MODE

public static final int CLASSIC_VIEW_MODE
Symbol indicating the manager is supporting a swing external frames view, using javax.swing.JFrame;

See Also:
Constant Field Values

NON_SWING_VIEW_MODE

public static final int NON_SWING_VIEW_MODE
Symbol indicating the manager is supporting a non-swing external frames view, using java.awt.Frame;

See Also:
Constant Field Values

MDI_VIEW_MODE

public static final int MDI_VIEW_MODE
Symbol indicating the manager is supporting a swing internal frames view, using javax.swing.JIntenralFrame; [Internal frames are not quite ready for prime time.]

See Also:
Constant Field Values

TABBED_MULTIVIEW_MODE

public static final int TABBED_MULTIVIEW_MODE
Symbol indicating that views added should be put into a tabbed layout.

See Also:
Constant Field Values

GRID_MULTIVIEW_MODE

public static final int GRID_MULTIVIEW_MODE
Symbol indicating that views added should be put into a grid layout.

See Also:
Constant Field Values

GRID_MULTIVIEW_LABEL_MODE

public static final int GRID_MULTIVIEW_LABEL_MODE
Symbol indicating that views added should be put into a grid layout, with a name appearing above each panel..

See Also:
Constant Field Values

BUTTON_ROLLOVER_COLOR

protected static final java.awt.Color BUTTON_ROLLOVER_COLOR
The Constant BUTTON_ROLLOVER_COLOR.


ACCENT_COLOR

protected static final java.awt.Color ACCENT_COLOR
The Constant ACCENT_COLOR.

Constructor Detail

DesktopEnvironment

public DesktopEnvironment()
Instantiates a new user environment.

Method Detail

environmentQuiting

public void environmentQuiting(ScapeEvent scapeEvent)
Setup up a basic interactive controlBar time userEnvironment for a model application.

Specified by:
environmentQuiting in interface ScapeListener
Overrides:
environmentQuiting in class RuntimeEnvironment
Parameters:
scapeEvent - the scape event

scapeAdded

public void scapeAdded(ScapeEvent scapeEvent)
                throws java.util.TooManyListenersException
When a scape is added add any persiten views to it and set frame title.

Specified by:
scapeAdded in interface ScapeListener
Overrides:
scapeAdded in class RuntimeEnvironment
Parameters:
scapeEvent - the scape event
Throws:
java.util.TooManyListenersException - the too many listeners exception

scapeRemoved

public void scapeRemoved(ScapeEvent scapeEvent)
When a scape is removed reset frame title.

Specified by:
scapeRemoved in interface ScapeListener
Overrides:
scapeRemoved in class DefaultScapeListener
Parameters:
scapeEvent - the scape event
See Also:
scapeAdded

registerViewFrame

protected void registerViewFrame(ViewFrameBridge v)
Register view frame.

Parameters:
v - the v

createFrame

public void createFrame(ComponentView[] views)
Description copied from class: SwingEnvironment
Creates the frame.

Specified by:
createFrame in class SwingEnvironment
Parameters:
views - the views

placeRandomLocation

public void placeRandomLocation(java.awt.Container frameImp)
Places the window in a random location.

Parameters:
frameImp - the frame imp

getApplet

public ModelApplet getApplet()
If model is running in an applet vm context, returns the applet.

Returns:
the applet

setApplet

public void setApplet(java.lang.Object _applet,
                      Scape parent)
Sets the applet scape views are to be displayed within, indicating that we are in an applet vm context.

Specified by:
setApplet in class AbstractUIEnvironment
Parameters:
_applet - the _applet

getAppletModelPanel

public javax.swing.JPanel getAppletModelPanel()
If model is running in an applet vm context, returns the applet.

Returns:
the applet model panel

displayAboutDialog

public static void displayAboutDialog(Scape scape)
Displays a standard about dialog.

Parameters:
scape - the scape

checkForLicenseAgreement

public static void checkForLicenseAgreement()
Check for license agreement.


isInApplet

public boolean isInApplet()
Are we in an applet vm context? returns true if this scape is viewed in an applet, false otherwise.

Specified by:
isInApplet in class AbstractUIEnvironment
Returns:
true, if is in applet

supportsSwing

public boolean supportsSwing()
Returns the view viewMode being used.

Returns:
true, if supports swing

getViewMode

public int getViewMode()
Returns the view viewMode being used.

Returns:
the view mode

setViewMode

public void setViewMode(int _viewMode)
Sets the viewMode to use.

Parameters:
_viewMode - the _view mode

getMultiViewMode

public int getMultiViewMode()
Returns the multi view mode that will be used when adding any new windows. If TABBED_MULTIVIEW_MODE, views that are added together will be placed in seperate tabbed panels (viewable individually, taking up much less space.) If GRID_MULTIVIEW_MODE, views that are added together will be placed in a girdlayout (viewable all at once, taking up much more space.) Default is grid view for compatibility, but this may be changed. It is better to set the mode when you add multiple views.

Returns:
the multi view mode

setMultiViewMode

public void setMultiViewMode(int _multiViewMode)
Sets the multi view to use when adding a new window. If TABBED_MULTIVIEW_MODE, views that are added together will be placed in seperate tabbed panels (viewable individually, taking up much less space.) If GRID_MULTIVIEW_MODE, views that are added together will be placed in a girdlayout (viewable all at once, taking up much more space.)

Parameters:
_multiViewMode - the _multi view mode

getImage

public static java.awt.Image getImage(java.lang.String string)
Utility method to return an image resource as specified according to the rules of Class.getResource.

Parameters:
string - the resource reference of the image to load
Returns:
the image

getIcon

public static javax.swing.ImageIcon getIcon(java.lang.String imageName)
Utility method to return an image icon. The image icon must be in the [lib]/org.ascape/view/images directory, and it must be a gif, ending \".gif.\" Comment out for web.

Parameters:
imageName - the name (without extension) specifiying the image icon to return
Returns:
the icon

setFullScreen

public void setFullScreen(boolean fullScreen)
Sets the full screen.

Parameters:
fullScreen - the new full screen

isFullScreen

public boolean isFullScreen()
Checks if is full screen.

Returns:
true, if is full screen

createToolbar

public static javax.swing.JToolBar createToolbar()
Creates the toolbar.

Returns:
the j tool bar

addToolBarButton

public static javax.swing.JButton addToolBarButton(javax.swing.JToolBar toolBar,
                                                   javax.swing.Action action)
A helper method to add a button to the provided toolbar for the specified action.

Parameters:
toolBar - the tool bar
action - the action
Returns:
the j button

removeToolBarButton

public static void removeToolBarButton(javax.swing.JToolBar toolbar,
                                       javax.swing.Action action)
A helper method to remove a button from the provided toolbar for the specified action. Keep in mind that there are a number of tool bars, so be sure to specify the correct one.

Parameters:
toolbar - the toolbar
action - the action

addToolBarButton

public static javax.swing.JButton addToolBarButton(javax.swing.JToolBar toolBar)
A helper method to add a button to the provided toolbar for the specified action.

Parameters:
toolBar - the tool bar
Returns:
the j button

setupLabel

protected static void setupLabel(javax.swing.JLabel label)
Sets the up label.

Parameters:
label - the new up label

createLabel

protected static javax.swing.JLabel createLabel()
Creates the label.

Returns:
the j label

createLabel

public static javax.swing.JLabel createLabel(int width)
Creates the label.

Parameters:
width - the width
Returns:
the j label

getPropertySupportForObject

public java.beans.PropertyChangeSupport getPropertySupportForObject(java.lang.Object object)
Returns PropertyChangeSupport for the object provided. This property change support should then be used to manage all UI edited property changes. All customizers, inspectors and renderers should use this object to ensure that they are properly updated when a change to an object occurs and that they properly notify property change support when they cause a change to occur. Note that for efficiency reasons, computed (e.g. through a running model) changes are _not_ reported using this mechanism, and setters should not fire their own property change events. Renderers should instead register as ScapeListeners to ensure that they are properly notified of changes in model state. Thus, the supporting map is assumed to be relativly sparse, and should only contain those objects that have at one point been activly edited or rendered through an inspector, customizer or other UI tool.

Parameters:
object - an object of relevance to user
Returns:
a manger for proerty changes.

getInfoAreaBorder

public static javax.swing.border.Border getInfoAreaBorder()
Gets the info area border.

Returns:
the info area border

getSelectionManager

public AgentSelectionManager getSelectionManager()
Gets the selection manager.

Returns:
the selection manager

getUserFrame

public UserFrame getUserFrame()
Gets the user frame.

Returns:
the user frame

setUserFrame

public void setUserFrame(UserFrame userFrame)
Sets the user frame.

Parameters:
userFrame - the new user frame


Copyright © 1998-2008 The Brookings Institution, NuTech Solutions, Metascape, LLC All Rights Reserved.