triptracker.client.gps.ui
Class MainForm

java.lang.Object
  extended by triptracker.client.net.GPSSocketAdapter
      extended by triptracker.client.gps.ui.MainForm
All Implemented Interfaces:
GPSListener, GPSSocketListener, SocketListener, Form

public class MainForm
extends GPSSocketAdapter
implements Form, GPSListener


Field Summary
protected  JButton gpsButton
           
protected  JSpinner intervalSpinner
           
protected  String name
           
protected static int nameCount
           
protected  JButton serverButton
           
 
Constructor Summary
MainForm(GPSGui view, GPSClientModel model)
           
MainForm(GPSGui view, GPSClientModel model, String name)
           
 
Method Summary
 void addGPSBtnListener(ActionListener listener)
          Register a listener on the GPS button.
 void addServerBtnListener(ActionListener listener)
          Register a listener on the Server button.
 void addSpinnerListener(ChangeListener listener)
          Adds an changelistener for the intervalspinner.
 void addTimerListener(ActionListener listener)
          Adds an actionlistener for the timer.
 void bufferToFile()
          Changes the text and icon on the server button to buffer mode, also changes the status msg.
 void connected(boolean connected)
          Invoked when a GPS unit is connected or disconnected.
 void connectionUpdate(ConnectionState state)
          Invoked when the connection state of the underlying socket has changed.
 void coordReceived(Coordinate coord)
          Invoked when a new coordinate is received from the GPS unit.
 void createTimer(ActionListener listener)
          Creates a new timer
 JComponent getFormComponent()
          Gets the form's component
 int getInterval()
          Gets the interval to get data from the GPS-unit
 String getName()
          Gets the form name
 Timer getTimer()
          Get the current timer
 void increaseRecievedField()
          Increases the number of recieved coordinates
 void pauseFromGPS()
          Changes the text and icon on the GPS button to pause mode, also changes the status msg.
 void readExcepion(IOException e)
          Handles an read exception when trying to read data from the GPS-unit
 void recieveFromGPS()
          Changes the text and icon on the GPS button to recieve mode, also changes the status msg.
 void refreshView()
          Refreshes the form
 void setActiveRoute(String route)
          Sets the activeroute label
 void setDistField(double dist)
          Sets the distance field.
 void setGPSBtnTxt(String text)
          Changes the text on the gpsButton.
 void setLastUpdateField(String update)
          Sets the last updated field
 void setLatLonFields(String lat, String lon)
          Sets the latitude / logitude fields
 void setServerBtnTxt(String text)
          Changes the text on the serverButton.
 void setStatusMsg(String status)
          Set the status message on the status bar.
 void showErrorDialog(String heading, String error)
          Shows an error dialog.
 void showLogin()
          Shows the loginform.
 void showMain()
          Show main form.
 void showRoutes()
          Show route form
 void startTimer()
          Starts the timer.
 void statusUpdate(GPSStatusState state)
          Invoked when the state for the connected GPS unit changes.
 void stopTimer()
          Stops the timer.
 boolean timerIsRunning()
          Checks wether the timer is running or not
 boolean transferBufferedDialog()
          Creates a dialog for transfer buffered coordinates or not
 void transferToServer()
          Transferring to server, changes status message, text on server button and the server button icon to transfer mode.
 
Methods inherited from class triptracker.client.net.GPSSocketAdapter
invalidMessage, routeCreated, routeList, socketError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final String name

nameCount

protected static int nameCount

gpsButton

protected final JButton gpsButton

serverButton

protected final JButton serverButton

intervalSpinner

protected JSpinner intervalSpinner
Constructor Detail

MainForm

public MainForm(GPSGui view,
                GPSClientModel model)

MainForm

public MainForm(GPSGui view,
                GPSClientModel model,
                String name)
Method Detail

addGPSBtnListener

public void addGPSBtnListener(ActionListener listener)
Register a listener on the GPS button.

Parameters:
listener -

addSpinnerListener

public void addSpinnerListener(ChangeListener listener)
Adds an changelistener for the intervalspinner.

Parameters:
listener -

addTimerListener

public void addTimerListener(ActionListener listener)
Adds an actionlistener for the timer.

Parameters:
listener -

addServerBtnListener

public void addServerBtnListener(ActionListener listener)
Register a listener on the Server button.

Parameters:
listener -

getFormComponent

public JComponent getFormComponent()
Gets the form's component

Specified by:
getFormComponent in interface Form
Returns:
root JComponent object
See Also:
FormManager

getName

public String getName()
Gets the form name

Specified by:
getName in interface Form
Returns:
form name
See Also:
FormManager

coordReceived

public void coordReceived(Coordinate coord)
Description copied from interface: GPSListener
Invoked when a new coordinate is received from the GPS unit.

Specified by:
coordReceived in interface GPSListener
Parameters:
coord - the new coordinate

refreshView

public void refreshView()
Refreshes the form

Specified by:
refreshView in interface Form
See Also:
FormManager

getInterval

public int getInterval()
Gets the interval to get data from the GPS-unit

Returns:
interval to recieve data in secounds

setStatusMsg

public void setStatusMsg(String status)
Set the status message on the status bar.

Parameters:
status - status message

increaseRecievedField

public void increaseRecievedField()
Increases the number of recieved coordinates


setLatLonFields

public void setLatLonFields(String lat,
                            String lon)
Sets the latitude / logitude fields

Parameters:
lat - the coordinate's latitude
lon - the coordinate's logitude

setLastUpdateField

public void setLastUpdateField(String update)
Sets the last updated field

Parameters:
update - last updated

statusUpdate

public void statusUpdate(GPSStatusState state)
Description copied from interface: GPSListener
Invoked when the state for the connected GPS unit changes.

Specified by:
statusUpdate in interface GPSListener
Parameters:
state - new state

connected

public void connected(boolean connected)
Description copied from interface: GPSListener
Invoked when a GPS unit is connected or disconnected.

Specified by:
connected in interface GPSListener
Parameters:
connected - true if connected, false if disconnected

createTimer

public void createTimer(ActionListener listener)
Creates a new timer

Parameters:
listener - the listener

setServerBtnTxt

public void setServerBtnTxt(String text)
Changes the text on the serverButton.

Parameters:
text - the new text on the button

setGPSBtnTxt

public void setGPSBtnTxt(String text)
Changes the text on the gpsButton.

Parameters:
text - the new text on the button

showMain

public void showMain()
Show main form.


showErrorDialog

public void showErrorDialog(String heading,
                            String error)
Shows an error dialog.

Parameters:
heading - heading of the error dialog
error - the error itself

getTimer

public Timer getTimer()
Get the current timer

Returns:
Returns the timer.

showLogin

public void showLogin()
Shows the loginform.


stopTimer

public void stopTimer()
Stops the timer.


startTimer

public void startTimer()
Starts the timer.


timerIsRunning

public boolean timerIsRunning()
Checks wether the timer is running or not

Returns:
true if running

showRoutes

public void showRoutes()
Show route form


transferBufferedDialog

public boolean transferBufferedDialog()
Creates a dialog for transfer buffered coordinates or not

Returns:
true if transfer

setActiveRoute

public void setActiveRoute(String route)
Sets the activeroute label

Parameters:
route - the active route

connectionUpdate

public void connectionUpdate(ConnectionState state)
Description copied from class: GPSSocketAdapter
Invoked when the connection state of the underlying socket has changed.

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

transferToServer

public void transferToServer()
Transferring to server, changes status message, text on server button and the server button icon to transfer mode.


recieveFromGPS

public void recieveFromGPS()
Changes the text and icon on the GPS button to recieve mode, also changes the status msg.


pauseFromGPS

public void pauseFromGPS()
Changes the text and icon on the GPS button to pause mode, also changes the status msg.


bufferToFile

public void bufferToFile()
Changes the text and icon on the server button to buffer mode, also changes the status msg.


readExcepion

public void readExcepion(IOException e)
Handles an read exception when trying to read data from the GPS-unit

Specified by:
readExcepion in interface GPSListener
Parameters:
e - the exception

setDistField

public void setDistField(double dist)
Sets the distance field.

Parameters:
dist - traveled distance


Copyright © 2006 Team Trip Tracker. All Rights Reserved.