protected void processEventProperties(Properties eventProps){
  int status;
  Node node;
  Line line;
  String cmd=eventProps.getProperty(COMMAND_FIELD);
  int index=PropUtils.intFromProperties(eventProps,INDEX_FIELD,ERROR_VALUE_INT);
  if (cmd.equals(NODE_OBJECT)) {
    int shape=PropUtils.intFromProperties(eventProps,SHAPE_FIELD,ERROR_VALUE_INT);
    if (index == ERROR_VALUE_INT) {
      Debug.error("NMGL: error parsing object index for node.");
      return;
    }
    node=nodeList.get(index);
    if (shape == 11) {
      String icon=eventProps.getProperty(ICON_FIELD);
      if (DEBUG)       Debug.output("NetMapReader: jimage  " + icon);
    }
    if (shape == NODE_DELETE) {
      if (node != null) {
        lineList.del(node);
        nodeList.del(node);
      }
    }
 else     if (shape == NODE_MOVE && node != null) {
      setNodePositionFromEventProps(node,eventProps);
      lineList.move(node);
      node.setTime(Double.parseDouble(eventProps.getProperty(TIME_FIELD,"0")));
    }
 else {
      status=PropUtils.intFromProperties(eventProps,STATUS_FIELD,0);
      int menu=PropUtils.intFromProperties(eventProps,MENU_FIELD,0);
      String label=eventProps.getProperty(LABEL_FIELD);
      if (label == null) {
        label=eventProps.getProperty(INDEX_FIELD);
      }
      String ip=eventProps.getProperty(IP_FIELD);
      boolean isLocalhost=false;
      if (ip != null && localhostIP != null) {
        isLocalhost=localhostIP.equals(ip);
        if (DEBUG) {
          Debug.output("NetMapGraphicLoader displaying a node running on the localhost: " + localhostIP);
        }
      }
      if (DEBUG) {
        Debug.output("Creating node (" + label + ")");
      }
      try {
        if (shape != ERROR_VALUE_INT) {
          node=nodeList.add(label,index,shape,menu,status);
          node.setLocalhost(isLocalhost);
        }
      }
 catch (      Exception e) {
        Debug.error("NMGL: error creating node");
      }
      setNodePositionFromEventProps(node,eventProps);
    }
  }
 else   if (cmd.equals(NODE_OBJECT_STATUS)) {
    if (index == ERROR_VALUE_INT) {
      Debug.error("NMGL: error parsing object index for status update.");
      return;
    }
    node=nodeList.get(index);
    if (node != null) {
      status=PropUtils.intFromProperties(eventProps,STATUS_FIELD,ERROR_VALUE_INT);
      if (status != ERROR_VALUE_INT) {
        node.setStatus(status);
      }
    }
  }
 else   if (cmd.equals(LINK_OBJECT_STATUS)) {
    if (index == ERROR_VALUE_INT) {
      Debug.error("NMGL: error parsing line index for status update.");
      return;
    }
    line=lineList.get(index);
    if (line != null) {
      status=PropUtils.intFromProperties(eventProps,STATUS_FIELD,ERROR_VALUE_INT);
      if (status != ERROR_VALUE_INT) {
        line.setStatus(status);
      }
    }
  }
 else   if (cmd.equals(LINK_OBJECT)) {
    if (index == ERROR_VALUE_INT) {
      Debug.error("NMGL: error parsing line index for link.");
      return;
    }
    line=lineList.get(index);
    int shape=PropUtils.intFromProperties(eventProps,SHAPE_FIELD,ERROR_VALUE_INT);
    if (shape == NODE_DELETE) {
      lineList.del(index);
    }
 else {
      status=PropUtils.intFromProperties(eventProps,STATUS_FIELD,0);
      int node1=PropUtils.intFromProperties(eventProps,LINK_NODE1_FIELD,ERROR_VALUE_INT);
      int node2=PropUtils.intFromProperties(eventProps,LINK_NODE2_FIELD,ERROR_VALUE_INT);
      if (node1 == ERROR_VALUE_INT || node2 == ERROR_VALUE_INT) {
        Debug.error("NMGL: error parsing node indexes for link");
        return;
      }
      Node n1=nodeList.get(node1);
      Node n2=nodeList.get(node2);
      if (n1 != null && n2 != null) {
        lineList.add(String.valueOf(index),index,shape,status,n1,n2);
      }
 else {
        if (DEBUG) {
          Debug.output("NetMapGraphicLoader: can't create lobj, nodes are undefined");
        }
      }
    }
  }
 else   if (cmd.equals(REFRESH) || cmd.equals(UPDATE)) {
  }
 else   if (cmd.equals(CLEAR)) {
    if (nodeList != null) {
      nodeList.flush();
    }
    if (lineList != null) {
      lineList.flush();
    }
  }
 else {
    if (DEBUG) {
      Debug.output("NMGL: received unused event: " + eventProps.toString());
    }
  }
  manageGraphics();
}

protected void processEventProperties ( Properties eventProps ) { int status ; Node node ; Line line ; String cmd = eventProps . getProperty ( COMMAND_FIELD ) ; int index = PropUtils . intFromProperties ( eventProps , INDEX_FIELD , ERROR_VALUE_INT ) ; if ( cmd . equals ( NODE_OBJECT ) ) { int shape = PropUtils . intFromProperties ( eventProps , SHAPE_FIELD , ERROR_VALUE_INT ) ; if ( index == ERROR_VALUE_INT ) { Debug . error ( "NMGL: error parsing object index for node." ) ; return ; } node = nodeList . get ( index ) ; if ( shape == 11 ) { String icon = eventProps . getProperty ( ICON_FIELD ) ; if ( DEBUG ) Debug . output ( "NetMapReader: jimage  " + icon ) ; } if ( shape == NODE_DELETE ) { if ( node != null ) { lineList . del ( node ) ; nodeList . del ( node ) ; } } else if ( shape == NODE_MOVE && node != null ) { setNodePositionFromEventProps ( node , eventProps ) ; lineList . move ( node ) ; node . setTime ( Double . parseDouble ( eventProps . getProperty ( TIME_FIELD , "0" ) ) ) ; } else { status = PropUtils . intFromProperties ( eventProps , STATUS_FIELD , 0 ) ; int menu = PropUtils . intFromProperties ( eventProps , MENU_FIELD , 0 ) ; String label = eventProps . getProperty ( LABEL_FIELD ) ; if ( label == null ) { label = eventProps . getProperty ( INDEX_FIELD ) ; } String ip = eventProps . getProperty ( IP_FIELD ) ; boolean isLocalhost = false ; if ( ip != null && localhostIP != null ) { isLocalhost = localhostIP . equals ( ip ) ; if ( DEBUG ) { Debug . output ( "NetMapGraphicLoader displaying a node running on the localhost: " + localhostIP ) ; } } if ( DEBUG ) { Debug . output ( "Creating node (" + label + ")" ) ; } try { if ( shape != ERROR_VALUE_INT ) { node = nodeList . add ( label , index , shape , menu , status ) ; node . setLocalhost ( isLocalhost ) ; } } catch ( Exception e ) { Debug . error ( "NMGL: error creating node" ) ; } setNodePositionFromEventProps ( node , eventProps ) ; } } else if ( cmd . equals ( NODE_OBJECT_STATUS ) ) { if ( index == ERROR_VALUE_INT ) { Debug . error ( "NMGL: error parsing object index for status update." ) ; return ; } node = nodeList . get ( index ) ; if ( node != null ) { status = PropUtils . intFromProperties ( eventProps , STATUS_FIELD , ERROR_VALUE_INT ) ; if ( status != ERROR_VALUE_INT ) { node . setStatus ( status ) ; } } } else if ( cmd . equals ( LINK_OBJECT_STATUS ) ) { if ( index == ERROR_VALUE_INT ) { Debug . error ( "NMGL: error parsing line index for status update." ) ; return ; } line = lineList . get ( index ) ; if ( line != null ) { status = PropUtils . intFromProperties ( eventProps , STATUS_FIELD , ERROR_VALUE_INT ) ; if ( status != ERROR_VALUE_INT ) { line . setStatus ( status ) ; } } } else if ( cmd . equals ( LINK_OBJECT ) ) { if ( index == ERROR_VALUE_INT ) { Debug . error ( "NMGL: error parsing line index for link." ) ; return ; } line = lineList . get ( index ) ; int shape = PropUtils . intFromProperties ( eventProps , SHAPE_FIELD , ERROR_VALUE_INT ) ; if ( shape == NODE_DELETE ) { lineList . del ( index ) ; } else { status = PropUtils . intFromProperties ( eventProps , STATUS_FIELD , 0 ) ; int node1 = PropUtils . intFromProperties ( eventProps , LINK_NODE1_FIELD , ERROR_VALUE_INT ) ; int node2 = PropUtils . intFromProperties ( eventProps , LINK_NODE2_FIELD , ERROR_VALUE_INT ) ; if ( node1 == ERROR_VALUE_INT || node2 == ERROR_VALUE_INT ) { Debug . error ( "NMGL: error parsing node indexes for link" ) ; return ; } Node n1 = nodeList . get ( node1 ) ; Node n2 = nodeList . get ( node2 ) ; if ( n1 != null && n2 != null ) { lineList . add ( String . valueOf ( index ) , index , shape , status , n1 , n2 ) ; } else { if ( DEBUG ) { Debug . output ( "NetMapGraphicLoader: can't create lobj, nodes are undefined" ) ; } } } } else if ( cmd . equals ( REFRESH ) || cmd . equals ( UPDATE ) ) { } else if ( cmd . equals ( CLEAR ) ) { if ( nodeList != null ) { nodeList . flush ( ) ; } if ( lineList != null ) { lineList . flush ( ) ; } } else { if ( DEBUG ) { Debug . output ( "NMGL: received unused event: " + eventProps . toString ( ) ) ; } } manageGraphics ( ) ; }
process a netmapevent properties object , which means that a properties object , representing an event from the netmap server , is evaluated and used to modify the nodecache and linecache accordingly .
