haifa.shopsim.UI.shopanim
Class ShopAnim

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--haifa.shopsim.UI.shopanim.ShopAnim
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, ShopAnimConstants, ShopChangeListener

public class ShopAnim
extends javax.swing.JPanel
implements ShopAnimConstants, ShopChangeListener

A graphical view of a Job Shop. Gets ShopChangeEvents but does not use the information in them. It rather uses a refrence to a ShopState object for this purpuse.

Version:
1.1
See Also:
Serialized Form

Inner Class Summary
(package private)  class ShopAnim.MachineCheckBox
           
(package private)  class ShopAnim.RouteCheckBox
           
 
Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.ActionStandin, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardState
 
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.JButton allButton
           
private  javax.swing.JPanel allNonePanel
           
(package private)  java.util.HashMap bufferIndexesMap
          Maps each buffer to an index (Integer).
protected static int DRAWING_HEIGHT
           
protected static int DRAWING_WIDTH
           
private  javax.swing.JPanel drawingPanel
           
private  int firstStreetHeight
           
private  int firstStreetWidth
           
private  int iconHeight
           
private  int iconWidth
           
protected  JobShopGraphics jobShopGraphics
          A reference to the the object that stores the graphics information of the job shop.
(package private)  java.awt.Point[][] machineCoords
           
protected  MachineAnimIcon[][] machines
          A matrix of refernces to Machine Icons.
(package private)  javax.swing.JCheckBox[] machinesCheckBoxes
           
(package private)  java.util.HashMap machinesMap
          Maps machine indexes (Integer objects) to MachineAnimIcon objects.
private  javax.swing.JPanel machinesPanel
           
(package private)  java.util.HashMap machinesSpotMap
           
(package private)  boolean[] machinesToView
          An array that specifies at each moment, which machines are to be drawn.
private  javax.swing.JButton noneButton
           
private  javax.swing.JPanel routeChoosePanel
          The panel on which there are two panels, one for machines and one for routes whole routes.
(package private)  java.util.HashMap routeEndsIndexesMap
          Maps route indexs (Integer) to (Integer) objects.
(package private)  java.util.HashMap routeEndsSidesMap
          Maps route indexs (Integer) to (Integer) objects. where the values are EAST/WEST/NORTH/SOUTH
(package private)  javax.swing.JCheckBox[] routesCheckBoxes
           
(package private)  java.util.HashMap routeStartsIndexesMap
          Maps route indexs (Integer) to (Integer) objects.
(package private)  java.util.HashMap routeStartsSidesMap
          Maps route indexs (Integer) to (Integer) objects. where the values are EAST/WEST/NORTH/SOUTH
(package private)  boolean[] routesToView
          An array that specifies at each moment, which routes are to be drawn.
protected  RouteAnimIcon[][] routeTips
          References to route tip icons.
(package private)  java.awt.Point[][] routeTipsCoords
           
protected  ShopData shopData
          A reference to the object that stores the information of the job shop.
protected  ShopState shopState
          A reference to the shopstate object.
protected static int STREET_HEIGHT
           
protected static int STREET_WIDTH
           
protected  int totalStreetHeight
           
protected  int totalStreetWidth
           
private  javax.swing.JPanel wholeRoutesPanel
           
 
Fields inherited from class javax.swing.JPanel
defaultLayout, uiClassID
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, actionMap, ACTIONMAP_CREATED, alignmentX, alignmentY, ANCESTOR_INPUTMAP_CREATED, ANCESTOR_USING_BUFFER, ancestorInputMap, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, CREATED_DOUBLE_BUFFER, flags, FOCUS_INPUTMAP_CREATED, focusInputMap, HAS_FOCUS, htmlKey, htmlView, inputVerifier, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, IS_PRINTING, IS_PRINTING_ALL, KEY_EVENTS_ENABLED, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, verifyInputWhenFocusTarget, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, WHEN_IN_FOCUSED_WINDOW_BINDINGS, WIF_INPUTMAP_CREATED, windowInputMap
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, 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 haifa.shopsim.UI.shopanim.ShopAnimConstants
EAST, NORTH, NOT_SET, NUM_MACHINE_SPOTS_HEIGHT, NUM_MACHINE_SPOTS_WIDTH, SOUTH, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ShopAnim(ShopData shopData_, JobShopGraphics jobShopGraphics_)
          Creates new ShopAnim
 
Method Summary
protected  void calcDims()
           
protected  void drawMachines(java.awt.Graphics g)
           
protected  void drawRoute(int rnum, java.awt.Graphics g)
           
protected  void drawRouteMachine(int machine, java.awt.Graphics g)
           
protected  void drawRoutes(java.awt.Graphics g)
           
protected  void drawRouteTips(java.awt.Graphics g)
           
 javax.swing.JPanel getRouteChoosePanel()
           
static void main(java.lang.String[] args)
          For testing.
 void paint(java.awt.Graphics g)
           
 void setShopState(ShopState shopState_)
           
private  void setUpDataStructures()
          sets up all of the datastrucutures and allocates Icons.
private  void setUpGUI()
          Sets up all of the GUI components.
 void shopChanged(ShopChangeEvent sce)
           
 
Methods inherited from class javax.swing.JPanel
, getAccessibleContext, getUIClassID, paramString, updateUI, writeObject
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, checkIfChildObscuredBySibling, clearFocusOwners, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paintWithBuffer, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, readObject, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, registerWithKeyboardManager, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFlag, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, unregisterWithKeyboardManager, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, 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

jobShopGraphics

protected JobShopGraphics jobShopGraphics
A reference to the the object that stores the graphics information of the job shop.

shopData

protected ShopData shopData
A reference to the object that stores the information of the job shop.

shopState

protected ShopState shopState
A reference to the shopstate object.

machines

protected MachineAnimIcon[][] machines
A matrix of refernces to Machine Icons. The references may either be null or lead to some icon.

routeTips

protected RouteAnimIcon[][] routeTips
References to route tip icons. This array of arrays is composed of NORTH,SOUTH,EAST,WEST.

routeTipsCoords

java.awt.Point[][] routeTipsCoords

machineCoords

java.awt.Point[][] machineCoords

machinesMap

java.util.HashMap machinesMap
Maps machine indexes (Integer objects) to MachineAnimIcon objects.

machinesSpotMap

java.util.HashMap machinesSpotMap

bufferIndexesMap

java.util.HashMap bufferIndexesMap
Maps each buffer to an index (Integer). The index is used by MachineAnimIcons. This means that the keys, buffers of the type (r,o) match values which are Integers 0,1,2. The meaning of the integers is the values that the machine icons use to reference the queues.

routeStartsIndexesMap

java.util.HashMap routeStartsIndexesMap
Maps route indexs (Integer) to (Integer) objects.

routeEndsIndexesMap

java.util.HashMap routeEndsIndexesMap
Maps route indexs (Integer) to (Integer) objects.

routeStartsSidesMap

java.util.HashMap routeStartsSidesMap
Maps route indexs (Integer) to (Integer) objects. where the values are EAST/WEST/NORTH/SOUTH

routeEndsSidesMap

java.util.HashMap routeEndsSidesMap
Maps route indexs (Integer) to (Integer) objects. where the values are EAST/WEST/NORTH/SOUTH

routesToView

boolean[] routesToView
An array that specifies at each moment, which routes are to be drawn.

machinesToView

boolean[] machinesToView
An array that specifies at each moment, which machines are to be drawn.

machinesCheckBoxes

javax.swing.JCheckBox[] machinesCheckBoxes

routesCheckBoxes

javax.swing.JCheckBox[] routesCheckBoxes

iconWidth

private int iconWidth

iconHeight

private int iconHeight

firstStreetWidth

private int firstStreetWidth

firstStreetHeight

private int firstStreetHeight

DRAWING_WIDTH

protected static final int DRAWING_WIDTH

DRAWING_HEIGHT

protected static final int DRAWING_HEIGHT

STREET_WIDTH

protected static final int STREET_WIDTH

STREET_HEIGHT

protected static final int STREET_HEIGHT

totalStreetWidth

protected int totalStreetWidth

totalStreetHeight

protected int totalStreetHeight

drawingPanel

private javax.swing.JPanel drawingPanel

routeChoosePanel

private javax.swing.JPanel routeChoosePanel
The panel on which there are two panels, one for machines and one for routes whole routes.

wholeRoutesPanel

private javax.swing.JPanel wholeRoutesPanel

machinesPanel

private javax.swing.JPanel machinesPanel

allNonePanel

private javax.swing.JPanel allNonePanel

allButton

private javax.swing.JButton allButton

noneButton

private javax.swing.JButton noneButton
Constructor Detail

ShopAnim

public ShopAnim(ShopData shopData_,
                JobShopGraphics jobShopGraphics_)
Creates new ShopAnim
Method Detail

setUpGUI

private void setUpGUI()
Sets up all of the GUI components.

setUpDataStructures

private void setUpDataStructures()
sets up all of the datastrucutures and allocates Icons. Bases data on the shopData and jobShopGraphics.

getRouteChoosePanel

public javax.swing.JPanel getRouteChoosePanel()

shopChanged

public void shopChanged(ShopChangeEvent sce)
Specified by:
shopChanged in interface ShopChangeListener

setShopState

public void setShopState(ShopState shopState_)

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JComponent

drawMachines

protected void drawMachines(java.awt.Graphics g)

drawRouteTips

protected void drawRouteTips(java.awt.Graphics g)

calcDims

protected void calcDims()

drawRoutes

protected void drawRoutes(java.awt.Graphics g)

drawRoute

protected void drawRoute(int rnum,
                         java.awt.Graphics g)

drawRouteMachine

protected void drawRouteMachine(int machine,
                                java.awt.Graphics g)

main

public static void main(java.lang.String[] args)
For testing.