protected void createNodesTable() throws Exception {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs(
       "Node", "Health", "Count", "Errors", "Time since last up", "Current Threads", "Action");
   end();
   end();
   tbody();
   for (Node n : router.getClusterManager().getAllNodesByCluster(params.get("cluster"))) {
     tr();
     td();
     createLink(
         "" + n.getHost() + ":" + n.getPort(),
         "node",
         "show",
         createQueryString(
             "cluster", params.get("cluster"), "host", n.getHost(), "port", "" + n.getPort()));
     end();
     createTds(
         n.isUp() ? "Up" : "Down",
         "" + n.getCounter(),
         String.format("%1$.2f%%", n.getErrors() * 100),
         formatDurationHMS(System.currentTimeMillis() - n.getLastUpTime()),
         "" + n.getThreads());
     td();
     createIcon("ui-icon-trash", "node", "delete", createQuery4Node(n));
     createIcon("ui-icon-circle-arrow-n", "node", "up", createQuery4Node(n));
     createIcon("ui-icon-circle-arrow-s", "node", "down", createQuery4Node(n));
     end();
     end();
   }
   end();
   end();
 }
 protected void createProxyRulesTable() throws UnsupportedEncodingException {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs("Name", "Listen Port", "Actions");
   end();
   end();
   tbody();
   for (ProxyRule rule : getProxyRules()) {
     tr();
     td();
     createLink(
         rule.toString(),
         "prule",
         "show",
         createQueryString("name", RuleUtil.getRuleIdentifier(rule)));
     end();
     createTds("" + rule.getKey().getPort());
     td().a()
         .href(
             "/admin/rule/delete?name="
                 + URLEncoder.encode(RuleUtil.getRuleIdentifier(rule), "UTF-8"))
         .span()
         .classAttr("ui-icon ui-icon-trash")
         .end(3);
     end();
   }
   end();
   end();
 }
 protected void createInterceptorTable(List<Interceptor> interceptors) {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs("Name", "Priority");
   end();
   end();
   tbody();
   for (Interceptor i : interceptors) {
     tr();
     createTds(i.getDisplayName(), "" + i.getPriority());
     end();
   }
   end();
   end();
 }
 protected void createSessionsTable(List<Session> sessions) {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs("Id", "Last Used");
   end();
   end();
   tbody();
   for (Session s : sessions) {
     tr();
     createTds(s.getId(), formatDurationHMS(System.currentTimeMillis() - s.getLastUsed()));
     end();
   }
   end();
   end();
 }
 protected void createStatusNodes(Node n) throws Exception {
   table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
   thead();
   tr();
   createThs("Status Code", "Count");
   end();
   end();
   tbody();
   synchronized (n.getStatusCodes()) {
     for (Map.Entry<Integer, Integer> codes : n.getStatusCodes().entrySet()) {
       tr();
       createTds("" + codes.getKey(), "" + codes.getValue());
       end();
     }
   }
   end();
   end();
 }
  protected void createClustersTable() throws UnsupportedEncodingException {
    table().attr("cellpadding", "0", "cellspacing", "0", "border", "0", "class", "display");
    thead();
    tr();
    createThs("Name", "#Nodes", "Health");
    end();
    end();
    tbody();
    for (Cluster c : router.getClusterManager().getClusters()) {
      tr();
      td();
      createLink(c.getName(), "clusters", "show", createQueryString("cluster", c.getName()));
      end();

      createTds(
          String.valueOf(router.getClusterManager().getAllNodesByCluster(c.getName()).size()),
          getFormatedHealth(c.getName()));
      end();
    }
    end();
    end();
  }
 protected void createTr(String... data) {
   tr();
   for (String d : data) td().text(d).end();
   end();
 }