// Lightstreamer Monitor Console Demo
// Table Management for the Server Details Section

//////////////// Table Management for Server Identification Data

  identificationGroup = ["monitor_identification"]
  identificationSchema = ["EDITION","VERSION","LICENSE_TYPE","CLIENT_ID","LOCAL_IP","LOCAL_HOST"];

  // create an OverwriteTable
  var identificationTable = new OverwriteTable(identificationGroup, identificationSchema, "MERGE");

  identificationTable.setDataAdapter("MONITOR");
  identificationTable.setSnapshotRequired(true);

  identificationTable.onItemUpdate = function(item, info) {
    // the Server address information is available on the client side;
    // we add this information as extra fields on the monitor_identification item,
    // in order to take advantage of the visual tables support for data display;
    // note that only one snapshot event is expected for this item,
    // which carries immutable information
    if (engineRef) {
        info.addField("LS_HOST", engineRef.connection.getLSHost(), true);
        info.addField("SERVER_ADDRESS", engineRef.getSessionServerAddress(), true);
      }
  };
  
  // define visual effects
  identificationTable.onChangingValues = function (itemPos, visualUpdateInfo, itemName) {
    if (visualUpdateInfo != null) {
      visualUpdateInfo.setHotTime(0);
      visualUpdateInfo.setRowStyle('infoValue', 'infoValue');
    }
  };

  // bind the table to the corresponding HTML elements
  pushPage.addTable(identificationTable, "license");


//////////////// Table Management for Server Local Port Data

  socketGroup = ["monitor_local_socket"]
  socketSchema = ["SERVER_NAME","LOCAL_PORT"];
  // also available: "LOCAL_INTERFACE","IS_SSL"

  // create an OverwriteTable
  var socketTable = new OverwriteTable(socketGroup, socketSchema, "MERGE");

  socketTable.setDataAdapter("MONITOR");
  socketTable.setSnapshotRequired(true);

  // define visual effects
  socketTable.onChangingValues = function (itemPos, visualUpdateInfo, itemName) {
    if (visualUpdateInfo != null) {
      visualUpdateInfo.setHotTime(0);
      visualUpdateInfo.setRowStyle('infoValue', 'infoValue');
    }
  };

  // bind the table to the corresponding HTML elements
  pushPage.addTable(socketTable, "socket");
