triptracker.client.map.ui
Class MapViewPanel

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 triptracker.client.map.ui.SuperPanel
                      extended by triptracker.client.map.ui.MapViewPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, MapSocketListener, SocketListener

public class MapViewPanel
extends SuperPanel
implements MapSocketListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Nested classes/interfaces inherited from interface triptracker.client.net.MapSocketListener
MapSocketListener.RouteState
 
Field Summary
 
Fields inherited from class triptracker.client.map.ui.SuperPanel
coordList, map, realtime, route, user
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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
MapViewPanel(MapSocket model, TabbedForm view)
          The constructor creates a JPanel for the map view
 
Method Summary
 void addFollowBtnListener(ItemListener listener)
           
 void addMoveBtnListener(MouseListener listener)
           
 void addResetBtnListener(ActionListener listener)
           
 void addZoomBtnListener(MouseListener listener)
           
 void addZoomInBtnListener(ActionListener listener)
          Adds listener to zoomInBtn
 void addZoomOutBtnListener(ActionListener listener)
          Adds listener to zoomOutBtn
 void connectionUpdate(ConnectionState state)
          Invoked when the connection state of the underlying socket has changed.
 void coordReceived(int routeId, Coordinate coord)
          Invoked when a coordinate is received.
 void coordsReceived(List<Coordinate> coords)
          Invoked when buffered coordinates is received.
 void invalidMessage(String message)
          Invoked when an invalid or unsupported message is received from the server.
 void resetMap()
          Resets map to initial state
 void routeList(List<Route> routes)
          Invoked when a list of routes is received.
 void routeReceived(int routeId, List<Coordinate> coords)
          Called from model when route is recieved from server
 void routeUpdate(int routeId, MapSocketListener.RouteState state)
          Invoked when the state of a route is changed.
 void setFollow(int follow)
           
 void setMove()
          Sets mouseKlick to center on selected position
 void setRoute(boolean realtime, Route route)
          Asks server for coordinates to selected route
 void setState(String state)
           
 void setZoom()
          Sets mouseKlick to zoom in on klicked position
 void socketError(IOException e)
          Invoked when a socket error is encountered.
 void userReceived(User user)
          Invoked when a rouser is received.
 void usersReceived(List<User> users)
          Unimplemented methods from interface
 
Methods inherited from class triptracker.client.map.ui.SuperPanel
getMap, getRoute, getUser, setCoordList, setRoute, setUser
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapViewPanel

public MapViewPanel(MapSocket model,
                    TabbedForm view)
The constructor creates a JPanel for the map view

Method Detail

addZoomInBtnListener

public void addZoomInBtnListener(ActionListener listener)
Adds listener to zoomInBtn


addZoomOutBtnListener

public void addZoomOutBtnListener(ActionListener listener)
Adds listener to zoomOutBtn


addZoomBtnListener

public void addZoomBtnListener(MouseListener listener)

addMoveBtnListener

public void addMoveBtnListener(MouseListener listener)

addFollowBtnListener

public void addFollowBtnListener(ItemListener listener)

addResetBtnListener

public void addResetBtnListener(ActionListener listener)

setRoute

public void setRoute(boolean realtime,
                     Route route)
Asks server for coordinates to selected route


setState

public void setState(String state)

setFollow

public void setFollow(int follow)

routeReceived

public void routeReceived(int routeId,
                          List<Coordinate> coords)
Called from model when route is recieved from server

Specified by:
routeReceived in interface MapSocketListener
Parameters:
routeId - route the list of coordinates belongs to
coords - list of coordinates

connectionUpdate

public void connectionUpdate(ConnectionState state)
Invoked when the connection state of the underlying socket has changed.

Specified by:
connectionUpdate in interface SocketListener
Parameters:
state - new connection state

usersReceived

public void usersReceived(List<User> users)
Unimplemented methods from interface

Specified by:
usersReceived in interface MapSocketListener
Parameters:
users - list of users

routeList

public void routeList(List<Route> routes)
Description copied from interface: MapSocketListener
Invoked when a list of routes is received.

Specified by:
routeList in interface MapSocketListener
Parameters:
routes - list of routes

coordReceived

public void coordReceived(int routeId,
                          Coordinate coord)
Description copied from interface: MapSocketListener
Invoked when a coordinate is received.

Specified by:
coordReceived in interface MapSocketListener
Parameters:
routeId - route the coordinate belongs to
coord - coordinate received

routeUpdate

public void routeUpdate(int routeId,
                        MapSocketListener.RouteState state)
Description copied from interface: MapSocketListener
Invoked when the state of a route is changed.

Specified by:
routeUpdate in interface MapSocketListener
Parameters:
routeId - route the state change applies to
state - the new state

invalidMessage

public void invalidMessage(String message)
Description copied from interface: SocketListener
Invoked when an invalid or unsupported message is received from the server. This happens when the message parser method (often SocketConnection.messageHandler(String)) fails to understand the message, or if it contains invalid data.

Specified by:
invalidMessage in interface SocketListener
Parameters:
message - the message that triggered the event

socketError

public void socketError(IOException e)
Description copied from interface: SocketListener
Invoked when a socket error is encountered. This generally means that the socket has been closed or at least disconnected from the server.

Specified by:
socketError in interface SocketListener
Parameters:
e - the error that triggered the event

userReceived

public void userReceived(User user)
Description copied from interface: MapSocketListener
Invoked when a rouser is received.

Specified by:
userReceived in interface MapSocketListener

coordsReceived

public void coordsReceived(List<Coordinate> coords)
Description copied from interface: MapSocketListener
Invoked when buffered coordinates is received.

Specified by:
coordsReceived in interface MapSocketListener
Parameters:
coords - list of coordinates

setZoom

public void setZoom()
Sets mouseKlick to zoom in on klicked position


setMove

public void setMove()
Sets mouseKlick to center on selected position


resetMap

public void resetMap()
Resets map to initial state



Copyright © 2006 Team Trip Tracker. All Rights Reserved.