jfreerails.client.top
Class UserInputOnMapController

java.lang.Object
  extended by java.awt.event.KeyAdapter
      extended by jfreerails.client.top.UserInputOnMapController
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener

public class UserInputOnMapController
extends java.awt.event.KeyAdapter

Handles key presses and mouse movements on the map - responsible for moving the cursor etc.

Author:
Luke

Nested Class Summary
private  class UserInputOnMapController.CursorMouseAdapter
           
 
Field Summary
private  ActionRoot actionRoot
           
private  BuildIndustryJPopupMenu buildIndustryJPopupMenu
           
private  BuildTrackController buildTrack
           
private  DialogueBoxController dialogueBoxController
           
private  boolean ignoreDragging
           
private static java.lang.String JFREERAILS_CLIENT_SOUNDS_BUILDTRACK_WAV
           
private static java.util.logging.Logger logger
           
private  MapViewJComponent mapView
           
private  ModelRoot modelRoot
           
private  javax.swing.event.MouseInputAdapter mouseInputAdapter
           
private  SoundManager soundManager
           
private  StationTypesPopup stationTypesPopup
           
private  TrackMoveProducer trackBuilder
           
 
Constructor Summary
UserInputOnMapController(ModelRoot mr, ActionRoot ar)
           
 
Method Summary
private  void cancelProposedBuild()
           
private  void cursorJumped(ImPoint to)
           
private  void cursorOneTileMove(ImPoint oldPosition, Step vector)
           
private  BuildTrackStrategy getBts()
           
private  ImPoint getCursorPosition()
           
private  boolean isIgnoreKeyEvents()
           
 void keyPressed(java.awt.event.KeyEvent e)
           
private  boolean legalRectangleContains(ImPoint tryThisPoint)
          Checks whether specified point is in legal rectangle.
private  void moveCursorJump(ImPoint tryThisPoint)
           
private  void moveCursorOneTile(Step v)
           
private  void playAppropriateSound()
           
private  void setCursorMessage(java.lang.String s)
           
private  void setCursorPosition(ImPoint p)
           
private  void setIgnoreKeyEvents(boolean ignoreKeyEvents)
           
 void setup(MapViewJComponent mv, TrackMoveProducer trackBuilder, StationTypesPopup stPopup, ModelRoot mr, DialogueBoxController dbc, FreerailsCursor cursor, BuildTrackController buildTrack)
           
 
Methods inherited from class java.awt.event.KeyAdapter
keyReleased, keyTyped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JFREERAILS_CLIENT_SOUNDS_BUILDTRACK_WAV

private static final java.lang.String JFREERAILS_CLIENT_SOUNDS_BUILDTRACK_WAV
See Also:
Constant Field Values

logger

private static final java.util.logging.Logger logger

stationTypesPopup

private StationTypesPopup stationTypesPopup

buildIndustryJPopupMenu

private BuildIndustryJPopupMenu buildIndustryJPopupMenu

mapView

private MapViewJComponent mapView

trackBuilder

private TrackMoveProducer trackBuilder

dialogueBoxController

private DialogueBoxController dialogueBoxController

modelRoot

private final ModelRoot modelRoot

actionRoot

private final ActionRoot actionRoot

mouseInputAdapter

private final javax.swing.event.MouseInputAdapter mouseInputAdapter

buildTrack

private BuildTrackController buildTrack

soundManager

private SoundManager soundManager

ignoreDragging

private boolean ignoreDragging
Constructor Detail

UserInputOnMapController

public UserInputOnMapController(ModelRoot mr,
                                ActionRoot ar)
Method Detail

cursorOneTileMove

private void cursorOneTileMove(ImPoint oldPosition,
                               Step vector)

playAppropriateSound

private void playAppropriateSound()

setup

public void setup(MapViewJComponent mv,
                  TrackMoveProducer trackBuilder,
                  StationTypesPopup stPopup,
                  ModelRoot mr,
                  DialogueBoxController dbc,
                  FreerailsCursor cursor,
                  BuildTrackController buildTrack)

cursorJumped

private void cursorJumped(ImPoint to)

getCursorPosition

private ImPoint getCursorPosition()

setCursorPosition

private void setCursorPosition(ImPoint p)

setCursorMessage

private void setCursorMessage(java.lang.String s)

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener
Overrides:
keyPressed in class java.awt.event.KeyAdapter

cancelProposedBuild

private void cancelProposedBuild()

moveCursorJump

private void moveCursorJump(ImPoint tryThisPoint)

legalRectangleContains

private boolean legalRectangleContains(ImPoint tryThisPoint)
Checks whether specified point is in legal rectangle.

Parameters:
tryThisPoint - ImPoint
Returns:
boolean

moveCursorOneTile

private void moveCursorOneTile(Step v)

getBts

private BuildTrackStrategy getBts()

setIgnoreKeyEvents

private void setIgnoreKeyEvents(boolean ignoreKeyEvents)

isIgnoreKeyEvents

private boolean isIgnoreKeyEvents()