private void calculatePositions() { List<IAgent> agents = Esb.getAgents(); for (IAgent a : agents) { RelativePoint rp = Esb.getScreenPosition(a); Point fromAgentScreenLocation = convertRelativePositionToPoint(rp); agentScreenPoints.put(a, fromAgentScreenLocation); GwtBitsCanvasRectangle item = new GwtBitsCanvasRectangle(fromAgentScreenLocation.x, fromAgentScreenLocation.y, 5, 5); item.text = a.getAgentName(); gwtBitsCanvas.add(item); List<IAgent> agentsThisAgentTalksTo = Esb.getListOfAgentsMessagesSentTo(a); if (agentsThisAgentTalksTo != null) { for (IAgent toAgent : agentsThisAgentTalksTo) { if (toAgent != null) { Point locationOfToAgent = agentScreenPoints.get(toAgent); if (locationOfToAgent != null) { GwtBitsSendMessageArrow newArrow = new GwtBitsSendMessageArrow( fromAgentScreenLocation.x, fromAgentScreenLocation.y, locationOfToAgent.x, locationOfToAgent.y, infoWindow); Map<IAgent, Map<String, DebugAgentToAgentMessageTotals>> totals = Esb.getAllMessageTotalsFromAgent(a); Map<String, DebugAgentToAgentMessageTotals> messTotalsToAgent = totals.get(toAgent); if (messTotalsToAgent != null) { List<DebugAgentToAgentMessageTotals> ttt = new ArrayList<DebugAgentToAgentMessageTotals>(); String text = ""; for (String stt : messTotalsToAgent.keySet()) { DebugAgentToAgentMessageTotals tt = messTotalsToAgent.get(stt); text = text + tt.messageType + ","; ttt.add(tt); } newArrow.text = text; newArrow.setMessageTotals(ttt); } gwtBitsCanvas.add(newArrow); } } } } } String s = "jhkhj"; Esb.getAgents(); }
public DebugAgentsMessagesMapWindow() { statusBar.add(mousexLabel); statusBar.add(mouseyLabel); mousexLabel.setWidth("100px"); infoWindow = MessageInfoWindowOnCanvas.getInstance(); infoWindow.setCanvas(gwtBitsCanvas); calculatePositions(); mainAgentsPanel.add(gwtBitsCanvas); mainAgentsPanel.add(statusBar); mainAgentsPanel.add(propertyPanel); initWidget(mainAgentsPanel); gwtBitsCanvas.addMouseMoveHandler( new MouseMoveHandler() { public void onMouseMove(MouseMoveEvent event) { mouseX = event.getRelativeX(gwtBitsCanvas.getElement()); mouseY = event.getRelativeY(gwtBitsCanvas.getElement()); mousexLabel.setText("" + mouseX); mouseyLabel.setText("" + mouseY); // // IAgent newagent =getSelectedAgent(); // if (currentAgent != newagent){ // setNewAgentSelected(newagent); // } } }); gwtBitsCanvas.addMouseOverAgentHandler( new MouseOverCanvasItemHandler() { @Override public void mouseOverCanvasItem(GwtBitsCanvasItemBaseClass canvasItem) { propertyPanel.clear(); propertyPanel.add(new Label(canvasItem.getDebugString())); } }); Esb.register(this); Esb.registerScreenPosition(this, 0.9, 0.9); }
private void setNewAgentSelected(IAgent newagent) { currentAgent = newagent; propertyPanel.clear(); propertyPanel.add(new Label(newagent.getAgentDescription())); messagesFromAgent = new ArrayList<EsbHistoryItem>(); for (EsbHistoryItem currentHistoryItem : Esb.getHistory()) { if (currentHistoryItem.senderAgent == newagent) { messagesFromAgent.add(currentHistoryItem); } } messagesToAgent = new ArrayList<EsbHistoryItem>(); for (EsbHistoryItem currentHistoryItem : Esb.getHistory()) { for (IAgent receiverAgent : currentHistoryItem.receiverAgents) { if (receiverAgent == newagent) { messagesToAgent.add(currentHistoryItem); } } } }