de.upb.swtpra05.group03.plugin
Class ICabSShuttlePlugin

java.lang.Object
  extended byjava.lang.Thread
      extended byde.upb.swtpra.visualisation.visualisation.plugin.PluginBase
          extended byde.upb.swtpra05.group03.plugin.ICabSShuttlePlugin
All Implemented Interfaces:
PluginControllerInterface, java.lang.Runnable

public class ICabSShuttlePlugin
extends de.upb.swtpra.visualisation.visualisation.plugin.PluginBase
implements PluginControllerInterface

This plugin will be loaded to display many informations about the CompanyShuttle in the visualisation client.

Version:
$Revision: 1.3 $

Field Summary
private  AccountData aD
          Used to cache information retrieved in the method
private  AccountPanel aP
          A component to display events on the bank account, that includes service, toll, penalty and profit events
private  OrderPanel oP
          A complex tree-like component to display all information we have about the orders our shuttle currently have.
private  RoutingPanel rP
          A list component to display the planned routing
private  ShuttleStatusPanel sP
          A component to display the current stretch, the current load and the margin of the shuttle
 
Fields inherited from class de.upb.swtpra.visualisation.visualisation.plugin.PluginBase
pluginPanel, running
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ICabSShuttlePlugin()
          The constructor for the class CompanyShuttlePlugin, used to initialize and set up the GridBagLayout and create the used panels.
 
Method Summary
private  void clearDataHolder()
          This method will clear all data in the DataHolder.
private  void handleRemoteShuttleMoved(de.upb.swtpra.kernel.visualisation.RemoteShuttleMoved rsm)
          This method handles all RemoteShuttleMoved messages the plugin receives.
private  void handleRemoteShuttleStatusChanged(de.upb.swtpra.kernel.visualisation.RemoteShuttleStatusChanged rssc)
          This method handles all RemoteShuttleStatusChanged messages the plugin receives
private  void handleRemoteShuttleStatusString(de.upb.swtpra.kernel.visualisation.RemoteShuttleStatusString rsss)
          This method handles all RemoteShuttleStatusString messages the plugin receives.
private  java.awt.GridBagConstraints makeGBC(int gridx, int gridy)
          Helper method to create a GridBagConstraints with some standard values.
private  java.awt.GridBagConstraints makeGBC(int gridx, int gridy, int weighty)
          Helper method to create a GridBagConstraints with some standard values.
 void run()
          The plugin can be a thread in the visualisationclient.
 void update(de.upb.swtpra.kernel.visualisation.RemoteObj o)
          New messages will be sended to the plugin by calling this method.
 
Methods inherited from class de.upb.swtpra.visualisation.visualisation.plugin.PluginBase
getPluginPanel, isRunning, stopPlugin
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

oP

private OrderPanel oP
A complex tree-like component to display all information we have about the orders our shuttle currently have.


aP

private AccountPanel aP
A component to display events on the bank account, that includes service, toll, penalty and profit events


rP

private RoutingPanel rP
A list component to display the planned routing


sP

private ShuttleStatusPanel sP
A component to display the current stretch, the current load and the margin of the shuttle


aD

private AccountData aD
Used to cache information retrieved in the method

See Also:
CompanyShuttlePlugin#handleRemoteShuttleMoved(RemoteShuttleMoved)
Constructor Detail

ICabSShuttlePlugin

public ICabSShuttlePlugin()
The constructor for the class CompanyShuttlePlugin, used to initialize and set up the GridBagLayout and create the used panels.

Method Detail

makeGBC

private java.awt.GridBagConstraints makeGBC(int gridx,
                                            int gridy)
Helper method to create a GridBagConstraints with some standard values.

Parameters:
gridx - The x-axis position
gridy - The y-axis position
Returns:
the created GridBagConstraints

makeGBC

private java.awt.GridBagConstraints makeGBC(int gridx,
                                            int gridy,
                                            int weighty)
Helper method to create a GridBagConstraints with some standard values.

Parameters:
gridx - The x-axis position
gridy - The y-axis position
weighty - The weight on the y-axis
Returns:
the created GridBagConstraints

run

public void run()
The plugin can be a thread in the visualisationclient. The plugin animates the ProgressBars as a thread.

Specified by:
run in interface java.lang.Runnable

update

public void update(de.upb.swtpra.kernel.visualisation.RemoteObj o)
New messages will be sended to the plugin by calling this method.

Parameters:
o - A remote object containing new information about the simulation. o can have the following types: RemoteOrderAssigned, RemoteShuttleMoved, RemoteShuttleStatusChanged, RemoteShuttleStatusString, RemoteShuttleBankrupt, RemoteShuttleDisqualified or RemoteGameConstants.

handleRemoteShuttleMoved

private void handleRemoteShuttleMoved(de.upb.swtpra.kernel.visualisation.RemoteShuttleMoved rsm)
This method handles all RemoteShuttleMoved messages the plugin receives. It will extract the information needed to generate an AccountData of TOLL.

Parameters:
rsm - a RemoteShuttleMoved message

handleRemoteShuttleStatusString

private void handleRemoteShuttleStatusString(de.upb.swtpra.kernel.visualisation.RemoteShuttleStatusString rsss)
This method handles all RemoteShuttleStatusString messages the plugin receives. Its possible that the string contains a pickaback object. If so, then it gets parsed and splittet into the objects it is representing. After that, the objects are passed to the DataHolder to store their content for the displaying components. The four panels then will get called to update themselfes.

Parameters:
rsss - a RemoteShuttleStatusString message

handleRemoteShuttleStatusChanged

private void handleRemoteShuttleStatusChanged(de.upb.swtpra.kernel.visualisation.RemoteShuttleStatusChanged rssc)
This method handles all RemoteShuttleStatusChanged messages the plugin receives

Parameters:
rssc - a RemoteShuttleStatusChanged message

clearDataHolder

private void clearDataHolder()
This method will clear all data in the DataHolder. It will be used if the run-method of the main plugin class gets called. That means, that the plugin is started again and it is possible, that the visclient is disconnected and reconnected to another simulation in the meantime. So remove all data because it is possible that the data is wrong.