uchicago.src.sim.gui
Class FrameFactory

java.lang.Object
  extended by uchicago.src.sim.gui.FrameFactory

public class FrameFactory
extends java.lang.Object

A Factory for JFrames that adds support for persistent location and size. Individual JFrames are identified by their title. So, two or more JFrames with the same title will be treated has having the same location and size.

Any JFrame created with createFrame will have its size and location (its bounds property) saved and indexed to that JFrame's title when the JFrame is closed. When a JFrame with this title is created its bounds are set to the saved value. The saved bounds information can also be accessed via the getBounds method.

The size and location data is persisted between application instances via an xml file. The file is stored in $HOME/fully_qualified_model_name_as_dir/frame_props.xml. So, for example, if the home directory is /home/nick and the fully qualified model name is uchicago.src.sim.heatBugs, then the file path is
/home/nick/.repast/uchicago/src/sim/heatBugs/frame_props.xml.
The xml itself is human readable, but is liable to change. An example follows:


 
 
 
    
    
 
 

Version:
$Revision: 1.11 $ $Date: 2004/11/03 19:50:59 $

Method Summary
static javax.swing.JFrame createFrame(java.lang.String title)
          Returns a new JFrame with specified title as its title and size and location if any.
static java.awt.Rectangle getBounds(java.lang.String frameTitle)
          Returns the bounds, if any, associated with this frameName.
static void load(java.lang.String fqModelName)
          Loads the frame data for the specified model.
static void saveFrameData(java.lang.String fqModelName)
          Saves the frame data for the specified model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

load

public static void load(java.lang.String fqModelName)
Loads the frame data for the specified model.

Parameters:
fqModelName - the name of the model to load the data for

createFrame

public static javax.swing.JFrame createFrame(java.lang.String title)
Returns a new JFrame with specified title as its title and size and location if any. If persistent location and size information is found for this title then the created JFrame will have that size and location.

Parameters:
title - the title of the JFrame to create
Returns:
a new JFrame with persistent size and location if any

getBounds

public static java.awt.Rectangle getBounds(java.lang.String frameTitle)
Returns the bounds, if any, associated with this frameName.

Parameters:
frameTitle - the title of the JFrame whose bounds data this returns
Returns:
the bounds associated wit the specified title, or null if no bounds are found for that title

saveFrameData

public static void saveFrameData(java.lang.String fqModelName)
Saves the frame data for the specified model. The size and location data is persisted between application instances via an xml file. The file is stored in $HOME/fully_qualified_model_name_as_dir/frame_props.xml. So, for example, if the home directory is /home/nick and the fully qualified model name is uchicago.src.sim.heatBugs, then the file path is
/home/nick/.repast/uchicago/src/sim/heatBugs/frame_props.xml.
The xml itself is human readable, but is liable to change. An example follows:


 
 
 
    
    
 
 

Parameters:
fqModelName - the fully qualified name of the model whose frame data we want to save