Package jadex.tools.comanalyzer
Class ComanalyzerPlugin
- java.lang.Object
-
- jadex.base.gui.plugin.AbstractJCCPlugin
-
- jadex.tools.comanalyzer.ComanalyzerPlugin
-
- All Implemented Interfaces:
IControlCenterPlugin
,IPropertiesProvider
public class ComanalyzerPlugin extends AbstractJCCPlugin
The comanalyzer plugin.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jadex.base.gui.plugin.AbstractJCCPlugin
AbstractJCCPlugin.ShowRemoteControlCenterHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected ComponentFilter[]
agentfilter
The global agentfilterprotected ToolTab
chart
protected javax.swing.JCheckBoxMenuItem[]
checkboxes
The checkbox items for selecting default values.protected IClockService
clockservice
The clock service.protected static java.lang.String
COMANALYZER_IMAGES
The icon pathsprotected ComponentList
componentlist
The global list of recognized agents.protected ComponentTreePanel
comptree
The agent tree table.protected ToolTab
diagram
protected ToolTab
graph
protected static javax.swing.UIDefaults
icons
The image icons.protected MessageFilter[]
messagefilter
The global messagefilterprotected MessageList
messagelist
The global list of recorded messages.protected boolean
observe_all_new
Observe all new agents.protected java.util.Set<IComponentIdentifier>
observed
The set of registered agent adapters.protected PaintMaps
paintmaps
The map of shared colors for message and agent representation..protected RefreshTask
refresh_task
The refresh task.protected static long
REFRESH1
Refresh every 1 secondprotected static long
REFRESH10
Refresh every 10 secondsprotected static long
REFRESH5
Refresh every 5 secondsprotected static long
REFRESHA
Refresh auto sensored (experimental).protected static long
REFRESHI
Refresh immediately.protected long
sleep
How long should the refresh process waitprotected javax.swing.JSplitPane
split
The split panel.protected java.util.Map<IComponentIdentifier,ISubscriptionIntermediateFuture<java.lang.Object>>
subscriptions
The observed components.protected ToolTab
table
The ToolTabs.protected java.util.Timer
timer
Timer for RefreshTaskprotected ToolPanel
tpanel
The ToolPanel.protected static java.lang.String[]
TYPES
The system event types.protected static ComponentFilter[]
zeromessages
The agentfilter for zero messages-
Fields inherited from class jadex.base.gui.plugin.AbstractJCCPlugin
jcc
-
-
Constructor Summary
Constructors Constructor Description ComanalyzerPlugin()
Create a new comanalyzer plugin.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addEvent(java.lang.Object event)
Entry point for agent notifications, called from swing thread.protected void
addMessageListener(java.util.List<Component> added)
Update message listeners after agents have been added.void
agentBorn(IComponentDescription ad)
Add the agent to the agentlistvoid
agentChanged(IComponentDescription ad)
void
agentDied(IComponentDescription ad)
Remove listeners and set agent state.void
applyAgentFilter()
Applies the current agentfilter to all agents.protected void
applyAgentFilter(Component agent)
Applies the current agentfilter to a single agent.protected void
applyAgentFilter(Component[] agents)
Applies the current agentfilter to the given agents.void
applyMessageFilter()
Applies the current messagefilter to all messages.protected void
applyMessageFilter(Message message)
Applies the current messagefilter to a single message.protected void
applyMessageFilter(Message[] messages)
Applies the current messagefilter to the given messages and notifies tools about changed set of messages.javax.swing.JMenu[]
createMenuBar()
Create menu bar.protected Message
createMessage(java.lang.Object event, java.lang.String xid, IComponentIdentifier sid, IComponentIdentifier rid, java.lang.Object body)
Creates a message object with the corresponding sender and receiver agents and adds them to the message and agentlist.protected IFilter
createMessageFilter(java.util.Set agents)
Create a transferable filter for a remote message listener.javax.swing.JComponent[]
createToolBar()
Create tool bar.javax.swing.JComponent
createView()
Create main panel.ComponentFilter[]
getAgentFilter()
ComponentList
getAgentList()
Component[]
getAgents()
Message
getMessage(int messageNr)
MessageFilter[]
getMessageFilter()
MessageList
getMessageList()
Message[]
getMessages()
java.lang.String
getName()
Return the unique name of this plugin.PaintMaps
getPaintMaps()
IFuture<Properties>
getProperties()
Get plugin properties to be saved in a project.javax.swing.Icon
getToolIcon(boolean selected)
Return the icon representing this plugin.IFuture<java.lang.Void>
init(IControlCenter jcc)
Initialize the plugin.boolean
isAddMessage(IComponentIdentifier s, java.lang.Object rs)
Invoked when a message event has been received.protected boolean
isDuplicate(java.lang.String xid, IComponentIdentifier rec)
Checks if this message is already in messagelist (same id and same receiver)void
removeAgentFilter()
Remove all agent filter except for the standard filters that are accessible by the standard tool tab toolbar.void
removeMessageFilter()
Removes the current messagefilter.protected void
removeMessageListener(java.util.List removed)
Update message listeners after agents have been removed.protected void
scheduleAutoRefresh()
Schedule the refresh time by retrieving the last duration for the update of the tools.void
setAgentFilter(ComponentFilter[] filter)
Sets a new agentfilter.void
setMessageFilter(MessageFilter[] filter)
IFuture<java.lang.Void>
setProperties(Properties props)
Set plugin properties loaded from a project.IFuture<java.lang.Void>
shutdown()
Shutdown the plugin.-
Methods inherited from class jadex.base.gui.plugin.AbstractJCCPlugin
getClassLoader, getJCC, getMenuBar, getToolBar, getView, isLazy, pushPlatformSettings
-
-
-
-
Field Detail
-
TYPES
protected static final java.lang.String[] TYPES
The system event types.
-
COMANALYZER_IMAGES
protected static final java.lang.String COMANALYZER_IMAGES
The icon paths- See Also:
- Constant Field Values
-
icons
protected static final javax.swing.UIDefaults icons
The image icons.
-
REFRESHI
protected static final long REFRESHI
Refresh immediately.- See Also:
- Constant Field Values
-
REFRESH1
protected static final long REFRESH1
Refresh every 1 second- See Also:
- Constant Field Values
-
REFRESH5
protected static final long REFRESH5
Refresh every 5 seconds- See Also:
- Constant Field Values
-
REFRESH10
protected static final long REFRESH10
Refresh every 10 seconds- See Also:
- Constant Field Values
-
REFRESHA
protected static final long REFRESHA
Refresh auto sensored (experimental).- See Also:
- Constant Field Values
-
sleep
protected long sleep
How long should the refresh process wait
-
timer
protected java.util.Timer timer
Timer for RefreshTask
-
refresh_task
protected RefreshTask refresh_task
The refresh task.
-
split
protected javax.swing.JSplitPane split
The split panel.
-
comptree
protected ComponentTreePanel comptree
The agent tree table.
-
checkboxes
protected javax.swing.JCheckBoxMenuItem[] checkboxes
The checkbox items for selecting default values.
-
tpanel
protected ToolPanel tpanel
The ToolPanel.
-
table
protected ToolTab table
The ToolTabs.
-
diagram
protected ToolTab diagram
-
graph
protected ToolTab graph
-
chart
protected ToolTab chart
-
componentlist
protected ComponentList componentlist
The global list of recognized agents.
-
messagelist
protected MessageList messagelist
The global list of recorded messages.
-
messagefilter
protected MessageFilter[] messagefilter
The global messagefilter
-
agentfilter
protected ComponentFilter[] agentfilter
The global agentfilter
-
zeromessages
protected static final ComponentFilter[] zeromessages
The agentfilter for zero messages
-
observe_all_new
protected boolean observe_all_new
Observe all new agents.
-
paintmaps
protected PaintMaps paintmaps
The map of shared colors for message and agent representation..
-
observed
protected java.util.Set<IComponentIdentifier> observed
The set of registered agent adapters.
-
subscriptions
protected java.util.Map<IComponentIdentifier,ISubscriptionIntermediateFuture<java.lang.Object>> subscriptions
The observed components.
-
clockservice
protected IClockService clockservice
The clock service.
-
-
Method Detail
-
init
public IFuture<java.lang.Void> init(IControlCenter jcc)
Initialize the plugin.- Specified by:
init
in interfaceIControlCenterPlugin
- Overrides:
init
in classAbstractJCCPlugin
-
shutdown
public IFuture<java.lang.Void> shutdown()
Shutdown the plugin.- Specified by:
shutdown
in interfaceIControlCenterPlugin
- Overrides:
shutdown
in classAbstractJCCPlugin
-
getProperties
public IFuture<Properties> getProperties()
Get plugin properties to be saved in a project.- Specified by:
getProperties
in interfaceIPropertiesProvider
- Overrides:
getProperties
in classAbstractJCCPlugin
-
setProperties
public IFuture<java.lang.Void> setProperties(Properties props)
Set plugin properties loaded from a project.- Specified by:
setProperties
in interfaceIPropertiesProvider
- Overrides:
setProperties
in classAbstractJCCPlugin
-
getName
public java.lang.String getName()
Description copied from interface:IControlCenterPlugin
Return the unique name of this plugin. This method may be called before init(). Used e.g. to store properties of each plugin.- Returns:
- "Comanalyzer"
- See Also:
IControlCenterPlugin.getName()
-
getToolIcon
public javax.swing.Icon getToolIcon(boolean selected)
Description copied from interface:IControlCenterPlugin
Return the icon representing this plugin. This method may be called before init().- Returns:
- The icon of comanalyzer.
- See Also:
jadex.base.gui.plugin.IControlCenterPlugin#getToolIcon()
-
createToolBar
public javax.swing.JComponent[] createToolBar()
Create tool bar.- Overrides:
createToolBar
in classAbstractJCCPlugin
- Returns:
- The tool bar.
-
createMenuBar
public javax.swing.JMenu[] createMenuBar()
Create menu bar.- Overrides:
createMenuBar
in classAbstractJCCPlugin
- Returns:
- The menu bar.
-
createView
public javax.swing.JComponent createView()
Create main panel.- Overrides:
createView
in classAbstractJCCPlugin
- Returns:
- The main panel.
-
agentDied
public void agentDied(IComponentDescription ad)
Remove listeners and set agent state.- Parameters:
ad
- The agent description of the agent that has died.
-
agentBorn
public void agentBorn(IComponentDescription ad)
Add the agent to the agentlist- Parameters:
ad
- The agent description of the agent that was born.
-
agentChanged
public void agentChanged(IComponentDescription ad)
- Parameters:
ad
- The agent description of the agent that has changed.
-
getMessageFilter
public MessageFilter[] getMessageFilter()
- Returns:
- The messagefilter.
-
setMessageFilter
public void setMessageFilter(MessageFilter[] filter)
- Parameters:
filter
- The messagefilter to set.
-
removeMessageFilter
public void removeMessageFilter()
Removes the current messagefilter.
-
applyMessageFilter
public void applyMessageFilter()
Applies the current messagefilter to all messages.
-
applyMessageFilter
protected void applyMessageFilter(Message message)
Applies the current messagefilter to a single message.- Parameters:
message
-
-
applyMessageFilter
protected void applyMessageFilter(Message[] messages)
Applies the current messagefilter to the given messages and notifies tools about changed set of messages. Does not change the master list of messages.- Parameters:
messages
- The messages to apply the filter to.
-
getAgentFilter
public ComponentFilter[] getAgentFilter()
- Returns:
- The agentfilter.
-
setAgentFilter
public void setAgentFilter(ComponentFilter[] filter)
Sets a new agentfilter.- Parameters:
filter
- The filter to set.
-
removeAgentFilter
public void removeAgentFilter()
Remove all agent filter except for the standard filters that are accessible by the standard tool tab toolbar.
-
applyAgentFilter
public void applyAgentFilter()
Applies the current agentfilter to all agents.
-
applyAgentFilter
protected void applyAgentFilter(Component agent)
Applies the current agentfilter to a single agent.- Parameters:
agent
- The agent the filter applied to.
-
applyAgentFilter
protected void applyAgentFilter(Component[] agents)
Applies the current agentfilter to the given agents.- Parameters:
agents
- The agents to apply the filter to.
-
getMessageList
public MessageList getMessageList()
- Returns:
- The messagelist.
-
getMessages
public Message[] getMessages()
- Returns:
- The array of messages.
-
getMessage
public Message getMessage(int messageNr)
- Parameters:
messageNr
- The message number of the message to be returned.- Returns:
- A specific message.
-
getAgentList
public ComponentList getAgentList()
- Returns:
- The agentlist.
-
getAgents
public Component[] getAgents()
- Returns:
- The array of agents.
-
getPaintMaps
public PaintMaps getPaintMaps()
- Returns:
- The paint map.
-
addEvent
protected void addEvent(java.lang.Object event)
Entry point for agent notifications, called from swing thread. Iterates the list of message attributes and creates message objects. The new messages are checked against the existing list of messages to skip such that are already in the system (like a message was first recorded form the sender than the message recorded from the receiver is skipped)- Parameters:
message_maps
- The list of attribute maps for creating messages.
-
isDuplicate
protected boolean isDuplicate(java.lang.String xid, IComponentIdentifier rec)
Checks if this message is already in messagelist (same id and same receiver)- Parameters:
source
- The attribute map for the message.- Returns:
true
if the message is already in the messagelist.
-
createMessage
protected Message createMessage(java.lang.Object event, java.lang.String xid, IComponentIdentifier sid, IComponentIdentifier rid, java.lang.Object body)
Creates a message object with the corresponding sender and receiver agents and adds them to the message and agentlist.- Parameters:
source
- The message attribute map.sid
- The sender agent id.rid
- The receivers agent id.- Returns:
-
scheduleAutoRefresh
protected void scheduleAutoRefresh()
Schedule the refresh time by retrieving the last duration for the update of the tools.
-
isAddMessage
public boolean isAddMessage(IComponentIdentifier s, java.lang.Object rs)
Invoked when a message event has been received.- Parameters:
msg
- The message adapter.
-
addMessageListener
protected void addMessageListener(java.util.List<Component> added)
Update message listeners after agents have been added.
-
removeMessageListener
protected void removeMessageListener(java.util.List removed)
Update message listeners after agents have been removed.
-
createMessageFilter
protected IFilter createMessageFilter(java.util.Set agents)
Create a transferable filter for a remote message listener.
-
-