org.tigris.gef.base
Class Globals

java.lang.Object
  extended by org.tigris.gef.base.Globals

public class Globals
extends java.lang.Object

This class stores global info that is needed by all Editors. For example, it aids in communication between the various Palette's and Editor's by holding the next global Mode.


Field Summary
protected static java.applet.Applet _applet
           
protected static Editor _curEditor
          The Editor that most recently contained the mouse.
protected static Mode _mode
          The next global mode.
protected static java.util.Hashtable _pcListeners
          A global dictionary of PropertyChangeListeners for Figs.
protected static Prefs _prefs
          The user's preferences for various editor features.
static IStatusBar _StatusBar
          The place where status messages will be written.
protected static boolean _sticky
          True if the next global Mode should remain as the next global mode even after it has been given to one editor.
protected static java.awt.MediaTracker _tracker
           
static java.util.Vector clipBoard
          Until jdk 1.2, this will be our clipboard TODO we have now gone beyond JDK1.2
static java.lang.String defaultStatus
          String to display when nothing important is being displayed.
static java.lang.String LastDirectory
          The directory most recently used in an open or save dialog
static int MAX_LISTENERS
          The most listeners a Fig can have, 4.
static boolean pastable
           
static java.lang.String REMOVE
           
static boolean ShowFigTips
          Determines if tool tips be are shown on Figs in diagrams, including ToDoItem headlines.
protected static java.beans.PropertyChangeListener universalListener
           
 
Constructor Summary
Globals()
           
 
Method Summary
static void addPropertyChangeListener(java.lang.Object src, java.beans.PropertyChangeListener l)
          Add a listener to a Fig.
static void addUniversalPropertyChangeListener(java.beans.PropertyChangeListener pcl)
           
static void clearStatus()
          Sets the status to its default (blank) string.
static Editor curEditor()
          Reply the Editor that most recently contained the mouse.
static void curEditor(Editor ce)
          Set the current Editor.
protected static Mode defaultMode()
          What mode should Editor's go into if the Palette is not requesting a specific mode?
static void firePropChange(java.lang.Object src, java.lang.String propName, boolean oldV, boolean newV)
          Send a property change event to listeners of the src Fig.
static void firePropChange(java.lang.Object src, java.lang.String propName, int oldV, int newV)
          Send a property change event to listeners of the src Fig.
static void firePropChange(java.lang.Object src, java.lang.String propName, java.lang.Object oldValue, java.lang.Object newValue)
          Send a property change event to listeners of the src Fig.
static java.applet.Applet getApplet()
           
static java.applet.AppletContext getAppletContext()
           
static java.awt.Image getImage(java.lang.String urlStr)
          Get an image from the given URL (usually a gif file).
static java.awt.Image getImage(java.net.URL url)
          Get an image from the given URL (usually a gif file).
static java.lang.String getLastDirectory()
           
static Prefs getPrefs()
          Reply the user's preferences.
static boolean getShowFigTips()
           
static boolean getSticky()
           
static Mode mode()
          Reply the next global mode.
static void mode(Mode m)
          Set the next global mode.
static void mode(Mode m, boolean s)
          Set the next global mode, and set it's stickiness.
static Mode nextMode()
          Determine the next global mode.
static void quit()
          Try to exit the applet or application.
static void removePropertyChangeListener(java.lang.Object s, java.beans.PropertyChangeListener listener)
           
static void removeUniversalPropertyChangeListener()
           
static void setApplet(java.applet.Applet a)
          If we are running as an applet, Store the Applet and AppletContext in a well known place.
static void setLastDirectory(java.lang.String s)
           
static void setShowFigTips(boolean b)
           
static void setStatusBar(IStatusBar sb)
          Sets the place where status messages will be written.
static void setSticky(boolean b)
          Set whether the next global mode should remain as the next global mode even after it has been given to one editor.
static void showDocument(java.lang.String urlString)
          If we are running as an applet, ask the browser to display the given URL.
static void showDocument(java.net.URL url)
          If we are running as an applet, ask the browser to display the given URL.
static void showDocument(java.net.URL url, java.lang.String target)
          If we are running as an applet, ask the browser to display the given URL.
static void showStatus(java.lang.String s)
          Show a string on the some status bar, or print a message on the console.
static java.awt.Frame someFrame()
          Return an exisiting instance of class Frame.
static void startPropertySheet()
          Open the property sheet.
static void waitForImages()
          Wait for all images to download.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REMOVE

public static final java.lang.String REMOVE
See Also:
Constant Field Values

_applet

protected static java.applet.Applet _applet

_tracker

protected static java.awt.MediaTracker _tracker

defaultStatus

public static java.lang.String defaultStatus
String to display when nothing important is being displayed. By default the string " " is used. Some applications may want to change this to "Ready." It should not be set to "", because that can mess up window layouts, causing the status line to disappear.


clipBoard

public static java.util.Vector clipBoard
Until jdk 1.2, this will be our clipboard TODO we have now gone beyond JDK1.2


pastable

public static boolean pastable

LastDirectory

public static java.lang.String LastDirectory
The directory most recently used in an open or save dialog


ShowFigTips

public static boolean ShowFigTips
Determines if tool tips be are shown on Figs in diagrams, including ToDoItem headlines.


_StatusBar

public static IStatusBar _StatusBar
The place where status messages will be written.


_prefs

protected static Prefs _prefs
The user's preferences for various editor features.


_sticky

protected static boolean _sticky
True if the next global Mode should remain as the next global mode even after it has been given to one editor.


_mode

protected static Mode _mode
The next global mode. This is given to an editor on mouse entry


_curEditor

protected static Editor _curEditor
The Editor that most recently contained the mouse.


_pcListeners

protected static java.util.Hashtable _pcListeners
A global dictionary of PropertyChangeListeners for Figs. Most Figs will not have any listeners at any given moment, so I did not want to allocate an instance variable to hold listeners. Instead I use this global Hashtable with Figs ans keys and arrays of up to 4 listeners as values.

Note: It is important that all listeners eventually remove themselves by calling removePropertyChangeListener. Otherwise this table will keep pointers that can reduce grabage collection.


universalListener

protected static java.beans.PropertyChangeListener universalListener

MAX_LISTENERS

public static int MAX_LISTENERS
The most listeners a Fig can have, 4.

Constructor Detail

Globals

public Globals()
Method Detail

setApplet

public static void setApplet(java.applet.Applet a)
If we are running as an applet, Store the Applet and AppletContext in a well known place.


getAppletContext

public static java.applet.AppletContext getAppletContext()

getApplet

public static java.applet.Applet getApplet()

getLastDirectory

public static java.lang.String getLastDirectory()

setLastDirectory

public static void setLastDirectory(java.lang.String s)

getShowFigTips

public static boolean getShowFigTips()

setShowFigTips

public static void setShowFigTips(boolean b)

setStatusBar

public static void setStatusBar(IStatusBar sb)
Sets the place where status messages will be written.


showStatus

public static void showStatus(java.lang.String s)
Show a string on the some status bar, or print a message on the console.


clearStatus

public static void clearStatus()
Sets the status to its default (blank) string.


showDocument

public static void showDocument(java.net.URL url)
If we are running as an applet, ask the browser to display the given URL.


showDocument

public static void showDocument(java.net.URL url,
                                java.lang.String target)
If we are running as an applet, ask the browser to display the given URL.


showDocument

public static void showDocument(java.lang.String urlString)
If we are running as an applet, ask the browser to display the given URL.


getImage

public static java.awt.Image getImage(java.net.URL url)
Get an image from the given URL (usually a gif file).


getImage

public static java.awt.Image getImage(java.lang.String urlStr)
Get an image from the given URL (usually a gif file).


waitForImages

public static void waitForImages()
Wait for all images to download.


quit

public static void quit()
Try to exit the applet or application. Needs-more-work: in the case of an applet, not all windows are closed.


getPrefs

public static Prefs getPrefs()
Reply the user's preferences.


startPropertySheet

public static void startPropertySheet()
Open the property sheet.


someFrame

public static java.awt.Frame someFrame()
Return an exisiting instance of class Frame. This is needed to create off-screen bit-maps. Needs-more-work: I think Swing keeps its own.


setSticky

public static void setSticky(boolean b)
Set whether the next global mode should remain as the next global mode even after it has been given to one editor.


getSticky

public static boolean getSticky()

defaultMode

protected static Mode defaultMode()
What mode should Editor's go into if the Palette is not requesting a specific mode?


mode

public static void mode(Mode m)
Set the next global mode.


mode

public static void mode(Mode m,
                        boolean s)
Set the next global mode, and set it's stickiness.


mode

public static Mode mode()
Reply the next global mode.


nextMode

public static Mode nextMode()
Determine the next global mode. This is called when a mode finishes whatever it was meant to accomplish. If the sticky flag is set, the current mode stays the next global mode. Otherwise the defaultMode becomes the next global mode.

See Also:
Mode.done()

curEditor

public static void curEditor(Editor ce)
Set the current Editor.


curEditor

public static Editor curEditor()
Reply the Editor that most recently contained the mouse.


addPropertyChangeListener

public static void addPropertyChangeListener(java.lang.Object src,
                                             java.beans.PropertyChangeListener l)
Add a listener to a Fig. Now the listener will get notifications of all property change events from that Fig.


addUniversalPropertyChangeListener

public static void addUniversalPropertyChangeListener(java.beans.PropertyChangeListener pcl)

removeUniversalPropertyChangeListener

public static void removeUniversalPropertyChangeListener()

removePropertyChangeListener

public static void removePropertyChangeListener(java.lang.Object s,
                                                java.beans.PropertyChangeListener listener)

firePropChange

public static void firePropChange(java.lang.Object src,
                                  java.lang.String propName,
                                  boolean oldV,
                                  boolean newV)
Send a property change event to listeners of the src Fig.


firePropChange

public static void firePropChange(java.lang.Object src,
                                  java.lang.String propName,
                                  int oldV,
                                  int newV)
Send a property change event to listeners of the src Fig.


firePropChange

public static void firePropChange(java.lang.Object src,
                                  java.lang.String propName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Send a property change event to listeners of the src Fig.