TaxiProject05.taxiSimulation
Class TestPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by TaxiProject05.taxiSimulation.TestPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, TaxiCommunicationListener

public class TestPanel
extends javax.swing.JPanel
implements TaxiCommunicationListener, java.io.Serializable

Author:
Group 5
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TestPanel(ModelInterface company)
           
 
Method Summary
 void abortDrive(java.lang.String regnr, int driveId)
          A drive is aborted, either if it's a booked drive where the customer didn't show up or if it's a started drive where the customer ran away.
 void endedDrive(java.lang.String regnr, int driveId, double distance, Position endpos, java.util.Date driveTime, double price, PaymentMethod paymentMethod, boolean isPayed)
           
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 void loggedIn(java.lang.String regnr, int driverId)
           
 void loggedOut(java.lang.String regnr)
          Event is sent when the taxi is parked.
 void paint(java.awt.Graphics g)
           
 void startedBookedDrive(java.lang.String regnr, int driveId, Position startpos, java.util.Date startTime)
          A customer is picked up on the street and a prebookd drive is started.
 int startedNewDrive(java.lang.String regnr, Route route, java.util.Date startTime, Customer customer, int nrOfPassangers)
          Is ran when a taxi picks up a person on the street.
 void statusChanged(java.lang.String regnr, TaxiStatus oldStatus, TaxiStatus newStatus)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getWidth, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface TaxiProject05.taxiSimulation.TaxiCommunicationListener
endedDrive
 

Constructor Detail

TestPanel

public TestPanel(ModelInterface company)
Method Detail

paint

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

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

loggedIn

public void loggedIn(java.lang.String regnr,
                     int driverId)
Specified by:
loggedIn in interface TaxiCommunicationListener

loggedOut

public void loggedOut(java.lang.String regnr)
Description copied from interface: TaxiCommunicationListener
Event is sent when the taxi is parked.

Specified by:
loggedOut in interface TaxiCommunicationListener
Parameters:
regnr - Identify the car.

startedNewDrive

public int startedNewDrive(java.lang.String regnr,
                           Route route,
                           java.util.Date startTime,
                           Customer customer,
                           int nrOfPassangers)
Description copied from interface: TaxiCommunicationListener
Is ran when a taxi picks up a person on the street.

Specified by:
startedNewDrive in interface TaxiCommunicationListener
Parameters:
regnr - Idenifiys the car
startTime - The real starttime for the pickup.
customer - If it's a formely known customer this is set to that customer, or else it's null.
Returns:
The DriveId assigned by the system.

startedBookedDrive

public void startedBookedDrive(java.lang.String regnr,
                               int driveId,
                               Position startpos,
                               java.util.Date startTime)
Description copied from interface: TaxiCommunicationListener
A customer is picked up on the street and a prebookd drive is started.

Specified by:
startedBookedDrive in interface TaxiCommunicationListener
Parameters:
regnr - Idenifiys the car
driveId - The booked drive's id.
startpos - The position where it started
startTime - The taxi time when it started.

endedDrive

public void endedDrive(java.lang.String regnr,
                       int driveId,
                       double distance,
                       Position endpos,
                       java.util.Date driveTime,
                       double price,
                       PaymentMethod paymentMethod,
                       boolean isPayed)

abortDrive

public void abortDrive(java.lang.String regnr,
                       int driveId)
Description copied from interface: TaxiCommunicationListener
A drive is aborted, either if it's a booked drive where the customer didn't show up or if it's a started drive where the customer ran away.

Specified by:
abortDrive in interface TaxiCommunicationListener
Parameters:
regnr - Id to the car.
driveId - The drive Id.

statusChanged

public void statusChanged(java.lang.String regnr,
                          TaxiStatus oldStatus,
                          TaxiStatus newStatus)