haifa.shopsim.UI
Class MainGUI

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--javax.swing.JApplet
                                |
                                +--haifa.shopsim.UI.MainGUI
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable

public class MainGUI
extends javax.swing.JApplet

This class is one of the several usuable products of the JobShopSimualtion Project. It is the Algorithm testing/educational tool. It is the class that should be run as the main class when running this tool as a stand alone application. It may also be run as an applet. See the main() method for information on command line parameters.

When run as an applet, job shop files may be loaded only from the host at which the applet is sitting. This should suffice for demonstration purpuses. see the init() method.

Applet code should be (assuming that a .jar file is used):




...


Note that the SHOP_DATA1 file is the one that is opened initially

See Also:
Serialized Form

Inner Class Summary
(package private)  class MainGUI.AlgorithmSelectionAction
          This class implements an action that occurs when a new algorithm is selected.
(package private)  class MainGUI.ExitAction
          This action calls the exitApplication() method in the case of an application.
(package private)  class MainGUI.OpenAction
          Handles the Open Action of the File menu.
 class MainGUI.PostGUIRunAction
          This class is a functor that holds the method that is done after a run.
(package private)  class MainGUI.ViewLogAction
          Use for displaying a pop-up window showing the algorithm's log.
 
Inner classes inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
private  javax.swing.JMenu algorithmMenu
           
private  javax.swing.JComponent animArea
           
private  javax.swing.JPanel centerPanel
           
private  javax.swing.JLabel commandLabel
           
private  ShopAlgorithm currentAlgorithm
          A refrence to the currently selected shopAlgorithm, may be null.
private  java.util.ArrayList dataFiles
          Stores names of urls specified by html to applet of data files.
private  javax.swing.JMenu fileMenu
           
(package private)  javax.swing.Action[] fileMenuActions
          Action events of the file menu.
private  javax.swing.JComponent ganttArea
           
private  java.lang.String HOME_PAGE
          If the user chooses exit during an applet, it is brought to this page.
private static boolean isApplication
          False if applet true if application
private  javax.swing.JPanel mainPanel
           
private  javax.swing.JMenuBar menuBar
           
private  int numSimulations
          Counts how many times the user started a simulation.
private  javax.swing.JRootPane rootPane
          Used when working with a JFrame and setting a menu.
private  ShopData shopData
          A reference to the data regarding the current job shop.
private  javax.swing.JTextArea shopDataArea
           
private  ShopRun shopRun
          A reference to the shopRun object (the object that runs the simulation).
private  ShopState shopState
          A refrence to the shopState.
private  StateTable stateTable
          A reference to the stateTable
private  javax.swing.JPanel topPanel
           
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPaneCheckingEnabled
 
Fields inherited from class java.applet.Applet
serialVersionUID, stub
 
Fields inherited from class java.awt.Panel
base, nameCounter
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MainGUI()
           
 
Method Summary
 void destory()
           
private  void exitApplet()
          Kills the applet and goes to HOME_PAGE with the browser.
private static void exitApplication()
          Called to exit.
 void init()
          Reads parameters, sets up, etc...
static void main(java.lang.String[] a)
          Needs to get single argument with .
 void setCommandLabel(java.lang.String cmd)
          Changes the command label
 MainGUI setUp(java.lang.String dataName, javax.swing.JRootPane rootPane_)
          Sets up everything.
 void start()
           
 void stop()
           
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, createRootPaneException, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paint, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setFont, transferFocus, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

numSimulations

private int numSimulations
Counts how many times the user started a simulation.

HOME_PAGE

private final java.lang.String HOME_PAGE
If the user chooses exit during an applet, it is brought to this page.

isApplication

private static boolean isApplication
False if applet true if application

rootPane

private javax.swing.JRootPane rootPane
Used when working with a JFrame and setting a menu.

mainPanel

private javax.swing.JPanel mainPanel

topPanel

private javax.swing.JPanel topPanel

centerPanel

private javax.swing.JPanel centerPanel

ganttArea

private javax.swing.JComponent ganttArea

animArea

private javax.swing.JComponent animArea

shopDataArea

private javax.swing.JTextArea shopDataArea

commandLabel

private javax.swing.JLabel commandLabel

menuBar

private javax.swing.JMenuBar menuBar

fileMenu

private javax.swing.JMenu fileMenu

algorithmMenu

private javax.swing.JMenu algorithmMenu

dataFiles

private java.util.ArrayList dataFiles
Stores names of urls specified by html to applet of data files.

fileMenuActions

javax.swing.Action[] fileMenuActions
Action events of the file menu. Each of these has a corresponeding inner class.

shopRun

private ShopRun shopRun
A reference to the shopRun object (the object that runs the simulation).

currentAlgorithm

private ShopAlgorithm currentAlgorithm
A refrence to the currently selected shopAlgorithm, may be null.

shopData

private ShopData shopData
A reference to the data regarding the current job shop.

shopState

private ShopState shopState
A refrence to the shopState.

stateTable

private StateTable stateTable
A reference to the stateTable
Constructor Detail

MainGUI

public MainGUI()
Method Detail

setUp

public MainGUI setUp(java.lang.String dataName,
                     javax.swing.JRootPane rootPane_)
Sets up everything. Returns 'this'. This is basically like a co'tr

setCommandLabel

public void setCommandLabel(java.lang.String cmd)
Changes the command label

init

public void init()
Reads parameters, sets up, etc...
Overrides:
init in class java.applet.Applet

start

public void start()
Overrides:
start in class java.applet.Applet

stop

public void stop()
Overrides:
stop in class java.applet.Applet

destory

public void destory()

exitApplet

private void exitApplet()
Kills the applet and goes to HOME_PAGE with the browser.

main

public static void main(java.lang.String[] a)
Needs to get single argument with . It then creates an application, that automatically opens this file. Currently, canno't run an application without an argument.

exitApplication

private static void exitApplication()
Called to exit. Currently just kills the JVM.