vanetsim.gui.controlpanels
Class ReportingControlPanel

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 vanetsim.gui.controlpanels.ReportingControlPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public final class ReportingControlPanel
extends javax.swing.JPanel
implements java.awt.event.ActionListener, java.awt.event.ItemListener

This class contains the control elements for display of statistics and mix zone information

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
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
ReportingControlPanel()
          Constructor for this control panel.
 
Method Summary
 void accumulateDetailedLogFiles()
          Opens log files and calculates data for diagram.
 float[] accumulateDetailFiles(java.util.ArrayList<java.io.File> files)
          Accumulates different versions of a scenario for a detailed analysis
 void accumulateSimpleLogFiles(java.lang.String mode)
          Opens log files and calculates data for diagram.
 float[] accumulateSimpleMixFiles(java.util.ArrayList<java.io.File> files)
          Accumulates different versions of a scenario for a simple mix-zone analysis
 float[] accumulateSimpleSilentPeriodFiles(java.util.ArrayList<java.io.File> files)
          Accumulates different versions of a scenario for a simple silent-period analysis
 void actionPerformed(java.awt.event.ActionEvent e)
          An implemented ActionListener which performs all needed actions when a JButton is clicked.
 void addBeacon(RSU rsu, long ID, long x, long y, boolean isEncrypted)
          Receive a beacon from a RSU in the monitored zone.
 void addBeacon(Vehicle vehicle, long ID, long x, long y, double speed, boolean isEncrypted)
          Receive a beacon from a vehicle in the monitored zone.
 void addBeacon(Vehicle vehicle, long ID, long x, long y, double speed, boolean isEncrypted, boolean isForwared)
          Receive a beacon from a vehicle in the monitored zone.
 void calculateStreetLength()
          Sums up the length of all the streets on the loaded map
 void checkUpdates(int timePerStep)
          This function should be called after each simulation step to determine if an update of statistics/beacon information is necessary
 void cleanLogFile()
          Exchanges the coordinates of a mix-zone-log with port numbers.
 int compare(java.lang.String[] string1, java.lang.String[] string2)
          Yes it is a own compareTo method, because java is annoying!!!
 void editDetailLogFiles()
          Reads detailed log files and calculates advanced information for diagrams
 java.util.ArrayList<java.io.File> getFileList(java.io.File file)
          Gets the different versions of a szenario log (searches for _version1..., _version2...)
 boolean isActive()
          Sets if this panel is currently active.
 boolean isInMonitoredMixZoneEditMode()
          Returns if editing of the monitored mix zone is enabled.
 void itemStateChanged(java.awt.event.ItemEvent e)
          Invoked when an item changes.
 void receiveMouseEvent(int x, int y)
          Receives a mouse event for changing the monitored mix zone.
 void setActive(boolean active)
          Sets if this panel is currently active
 void showAdvancedLocationInformation()
          Show the attack results on the map
 void updateBeaconInfo()
          Updates the statistics.
 
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, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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
 

Constructor Detail

ReportingControlPanel

public ReportingControlPanel()
Constructor for this control panel.

Method Detail

checkUpdates

public void checkUpdates(int timePerStep)
This function should be called after each simulation step to determine if an update of statistics/beacon information is necessary

Parameters:
timePerStep - the time of one simulation step in milliseconds

updateBeaconInfo

public void updateBeaconInfo()
Updates the statistics. You need to make sure that the vehicles are not modified while executing this.


addBeacon

public void addBeacon(Vehicle vehicle,
                      long ID,
                      long x,
                      long y,
                      double speed,
                      boolean isEncrypted)
Receive a beacon from a vehicle in the monitored zone.

Parameters:
vehicle - the vehicle
ID - the ID of the vehicle
x - the x coordinate of the vehicle
y - the y coordinate of the vehicle
speed - the speed of the vehicle
isEncrypted - if the beacon is encrypted

addBeacon

public void addBeacon(Vehicle vehicle,
                      long ID,
                      long x,
                      long y,
                      double speed,
                      boolean isEncrypted,
                      boolean isForwared)
Receive a beacon from a vehicle in the monitored zone.

Parameters:
vehicle - the vehicle
ID - the ID of the vehicle
x - the x coordinate of the vehicle
y - the y coordinate of the vehicle
speed - the speed of the vehicle
isEncrypted - if the beacon is encrypted
isForwared - if a beacon is forwared by an RSU

addBeacon

public void addBeacon(RSU rsu,
                      long ID,
                      long x,
                      long y,
                      boolean isEncrypted)
Receive a beacon from a RSU in the monitored zone.

Parameters:
rsu - the RSU
ID - the ID of the vehicle
x - the x coordinate of the vehicle
y - the y coordinate of the vehicle
isEncrypted - if Beacon was encrypted

receiveMouseEvent

public void receiveMouseEvent(int x,
                              int y)
Receives a mouse event for changing the monitored mix zone.

Parameters:
x - the x coordinate
y - the y coordinate

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
An implemented ActionListener which performs all needed actions when a JButton is clicked.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - an ActionEvent

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Invoked when an item changes. Used for the JCheckBoxes.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
e - the change event
See Also:
ItemListener.itemStateChanged(java.awt.event.ItemEvent)

isActive

public boolean isActive()
Sets if this panel is currently active.

Returns:
true if it is active, else false

isInMonitoredMixZoneEditMode

public boolean isInMonitoredMixZoneEditMode()
Returns if editing of the monitored mix zone is enabled.

Returns:
true if it is enabled, else false

setActive

public void setActive(boolean active)
Sets if this panel is currently active

Parameters:
active - true if it is active, else false

cleanLogFile

public void cleanLogFile()
                  throws java.io.IOException
Exchanges the coordinates of a mix-zone-log with port numbers. Has to be done before using the log-analyzer!

Throws:
java.io.IOException

calculateStreetLength

public void calculateStreetLength()
Sums up the length of all the streets on the loaded map


showAdvancedLocationInformation

public void showAdvancedLocationInformation()
Show the attack results on the map


accumulateSimpleMixFiles

public float[] accumulateSimpleMixFiles(java.util.ArrayList<java.io.File> files)
Accumulates different versions of a scenario for a simple mix-zone analysis

Parameters:
files - the different versions of a scenario analysis
Returns:
values for simple analysis

accumulateSimpleSilentPeriodFiles

public float[] accumulateSimpleSilentPeriodFiles(java.util.ArrayList<java.io.File> files)
Accumulates different versions of a scenario for a simple silent-period analysis

Parameters:
files - the different versions of a scenario analysis
Returns:
values for simple analysis

accumulateDetailFiles

public float[] accumulateDetailFiles(java.util.ArrayList<java.io.File> files)
Accumulates different versions of a scenario for a detailed analysis

Parameters:
files - the different versions of a scenario analysis
Returns:
values for a detailed analysis

getFileList

public java.util.ArrayList<java.io.File> getFileList(java.io.File file)
Gets the different versions of a szenario log (searches for _version1..., _version2...)

Parameters:
file -
Returns:

editDetailLogFiles

public void editDetailLogFiles()
Reads detailed log files and calculates advanced information for diagrams


accumulateDetailedLogFiles

public void accumulateDetailedLogFiles()
Opens log files and calculates data for diagram. More than one file can be opened. If there is more than one version (same scenario with new random vehicles) of the file opening one version is enough. The script will look for version1, version2, version3...


accumulateSimpleLogFiles

public void accumulateSimpleLogFiles(java.lang.String mode)
Opens log files and calculates data for diagram. More than one file can be opened. If there is more than one version (same scenario with new random vehicles) of the file opening one version is enough. The script will look for version1, version2, version3...


compare

public int compare(java.lang.String[] string1,
                   java.lang.String[] string2)
Yes it is a own compareTo method, because java is annoying!!!111einseins ;). Used to sort the files selected in the file chooser.

Parameters:
string1 - the first string
string2 - the string to compare to the first one
Returns: