jade.tools.sniffer
Class MMCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--jade.tools.sniffer.MMCanvas

public class MMCanvas
extends javax.swing.JPanel
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

Manages agents and messages on both canvas. It holds an agent list, a message list and all necessary methods for adding, removing and drawing these object. It also registers ad handles events from mouse

See Also:
JPanel, MouseListener, Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 AgentList al
           
 MessageList ml
           
 
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
 
Constructor Summary
MMCanvas(boolean type, MainWindow mWnd, PanelCanvas panCan, MainPanel mPan, MMCanvas other)
           
 
Method Summary
 void addAgent(Agent agent)
           
 void addMessage(Message mess)
          Adds a message to canvas message then repaints the canvas
 AgentList getAgentList()
          Returns an handler to the agent list.
 MessageList getMessageList()
          Returns an handler to the message list.
 boolean isPresent(java.lang.String agName)
          Looks if an agent is present on Agent Canvas
 void mouseClicked(java.awt.event.MouseEvent evt)
          This method is invoked every time a user double-click on a blue arrow in the message canvas: the double-click occurs on a blue arrow in the message canavs, a dialog box is displayed with the entire message.
 void mouseDragged(java.awt.event.MouseEvent evt)
           
 void mouseEntered(java.awt.event.MouseEvent evt)
           
 void mouseExited(java.awt.event.MouseEvent evt)
           
 void mouseMoved(java.awt.event.MouseEvent evt)
           
 void mousePressed(java.awt.event.MouseEvent evt)
          Method invoked everytime the use clicks on a blue arrow: it updates the TextMessage component displaying the type of the message.
 void mouseReleased(java.awt.event.MouseEvent evt)
           
 void paintComponent(java.awt.Graphics g)
           
 void rAgfromNoSniffVector(Agent agent)
          Adds an agent to canvas agent then repaints it
 void recMessage(Message newMess)
          Returns new messages and put them into canvas agent
 void removeAgent(java.lang.String agentName)
          Removes an agent from the canvas agent then repaints it
 void removeAllAgents()
          Removes all the agents and messages from their lists then repaints the canvas
 void removeAllMessages()
          Removes all the messages in the message list then repaints the canvas
 void repaintNoSniffedAgent(Agent agent)
           
 Agent selAgent(java.awt.event.MouseEvent evt)
          Returns an Agent if an Agent has been selected form the user, otherwise returns null.
 Message selMessage(java.awt.event.MouseEvent evt)
           
 void setAgentList(AgentList savedList)
          Set the agent list handler as the parameter passed then repaints the canvas
 void setMessageList(MessageList savedList)
          Set the message list handler as the parameter passed then repaints the canvas
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

al

public AgentList al

ml

public MessageList ml
Constructor Detail

MMCanvas

public MMCanvas(boolean type,
                MainWindow mWnd,
                PanelCanvas panCan,
                MainPanel mPan,
                MMCanvas other)
Method Detail

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Method invoked everytime the use clicks on a blue arrow: it updates the TextMessage component displaying the type of the message.
Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
evt - mouse event

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
This method is invoked every time a user double-click on a blue arrow in the message canvas: the double-click occurs on a blue arrow in the message canavs, a dialog box is displayed with the entire message.
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
evt - mouse event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent evt)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent evt)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent evt)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

selMessage

public Message selMessage(java.awt.event.MouseEvent evt)

selAgent

public Agent selAgent(java.awt.event.MouseEvent evt)
Returns an Agent if an Agent has been selected form the user, otherwise returns null.
Parameters:
evt - mouse event
Returns:
Agent selected or null if no Agent was selected

rAgfromNoSniffVector

public void rAgfromNoSniffVector(Agent agent)
Adds an agent to canvas agent then repaints it
Parameters:
agent - agent to be add

addAgent

public void addAgent(Agent agent)

removeAgent

public void removeAgent(java.lang.String agentName)
Removes an agent from the canvas agent then repaints it
Parameters:
agentName - agent to be removed

removeAllAgents

public void removeAllAgents()
Removes all the agents and messages from their lists then repaints the canvas

repaintNoSniffedAgent

public void repaintNoSniffedAgent(Agent agent)

addMessage

public void addMessage(Message mess)
Adds a message to canvas message then repaints the canvas
Parameters:
mess - message to be added

removeAllMessages

public void removeAllMessages()
Removes all the messages in the message list then repaints the canvas

isPresent

public boolean isPresent(java.lang.String agName)
Looks if an agent is present on Agent Canvas
Parameters:
agName - agent name to look for
Returns:
true if agent is present, false otherwise

getAgentList

public AgentList getAgentList()
Returns an handler to the agent list. The agent list contains all the agents contained in the Agent Canvas displayed by grey or red boxes
Returns:
handler to agent list

getMessageList

public MessageList getMessageList()
Returns an handler to the message list. The message list contains all sniffed messages displayed on the Message Canavs as blue arrows
Returns:
handler to the message list

setAgentList

public void setAgentList(AgentList savedList)
Set the agent list handler as the parameter passed then repaints the canvas
Parameters:
savedList - new list of agents

setMessageList

public void setMessageList(MessageList savedList)
Set the message list handler as the parameter passed then repaints the canvas
Parameters:
savedList - new list of messages

recMessage

public void recMessage(Message newMess)
Returns new messages and put them into canvas agent
Parameters:
newMess - new message