示例#1
0
 // ------------------------------------------------------------------------
 // NODE PAINTER
 // Put some function here to paint whatever you want over the node.
 // The x1,y1 coordinates are the top left corner within which the node will be drawn
 // The x2,y2 coordinates are the bottom right corner
 // Paint everything on the graphics object
 // this function is called by DisplayManager
 public void PaintNode(Integer pNodeNumber, int x1, int y1, int x2, int y2, Graphics g) {
   NodeInfo nodeInfo = (NodeInfo) proprietaryNodeInfo.get(pNodeNumber);
   if (nodeInfo == null) return;
   int light = nodeInfo.GetValue();
   if (light == -1) return;
   nodeInfo.centerX = (x1 + x2) / 2;
   nodeInfo.centerY = (y1 + y2) / 2;
   // System.out.println(pNodeNumber);
 }
示例#2
0
  // ------------------------------------------------------------------------
  // *****---Packet Recieved event handler---******//
  // this function will be called by the thread running the packetReciever
  // everytime a new packet is recieved
  // make sure it is synchronized if it modifies any of your data
  public synchronized void PacketReceived(PacketEvent e) {
    // this function defines what you do when a new packet is heard by the system (recall that the
    // parent class (PacketAnalyzer) already registered you to listen for new packets automatically)
    // if this is a long function, you should call it in a seperate thread to allow the
    // PacketReciever thread to continue recieving packets

    Packet packet = e.GetPacket();
    Vector node_list = packet.CreateRoutePathArray();
    for (int i = 0; i < node_list.size() - 1; i++) {
      Integer currentNodeNumber = (Integer) node_list.elementAt(i);
      NodeInfo currentNodeInfo;
      if ((currentNodeInfo = (NodeInfo) proprietaryNodeInfo.get(currentNodeNumber)) != null) {
        currentNodeInfo.SetValue(packet.getValue());
      }
    }
  }
示例#3
0
 // ------------------------------------------------------------------------
 // INTERFACE TO PROPRIETARY DATA
 // write some functions here that will let other Analyzers find and user your data
 public NodeInfo GetNodeInfo(Integer nodeNumber) {
   return (NodeInfo) proprietaryNodeInfo.get(nodeNumber);
 }
示例#4
0
 // ------------------------------------------------------------------------
 // GET PROPRIETARY NODE INFO PANEL
 // This function returns the Panel that you define it to retunr
 // which will then automatically appear ina dialog when a node is clicked.
 // this function is called by DisplayManager
 public ActivePanel GetProprietaryNodeInfoPanel(Integer pNodeNumber) {
   NodeInfo nodeInfo = (NodeInfo) proprietaryNodeInfo.get(pNodeNumber);
   if (nodeInfo == null) return null;
   ProprietaryNodeInfoPanel panel = new ProprietaryNodeInfoPanel(nodeInfo);
   return (ActivePanel) panel;
 }