response.setContentType("text/html"); out = response.getWriter(); format = FORMAT_HTML; List agents = getAllEncodedAgentNames(); out.println( "<html>\n" + "<head>\n" + "<title>"+ getTitlePrefix()+ "Completion of All Agents</title>\n" + "</head>"); boolean use_iframes = false; String browser = request.getHeader("user-agent").toLowerCase(); if (browser != null) { for (int i = 0; i < iframeBrowsers.length; i++) { if (browser.indexOf(iframeBrowsers[i]) >= 0) { use_iframes = true; break; } } } if (use_iframes) { out.println( "<body>\n"+ "<h2><center>"+ getTitlePrefix()+ "Completion of All Agents</h2></center>"); for (int i = 0, n = agents.size(); i < n; i++) { int col = i % 3; String agentName = (String) agents.get(i); out.println( "<iframe src=\"/$" + agentName + getPath() + "?viewType=viewAgentSmall\""+ " scrolling=\"no\" width=300 height=90>" + agentName + "</iframe>\n"+ "</td>"); } out.println("</body>"); } else { int totalAgents = agents.size(); int nagents = totalAgents; String firstAgent = request.getParameter("firstAgent"); int agent0 = 0; boolean needMore = false; String title = "All Agents"; if (firstAgent != null) { try { agent0 = Integer.parseInt(firstAgent); if (agent0 < 0) { agent0 = 0; } else if (agent0 >= nagents) { agent0 = nagents - MAX_AGENT_FRAMES; } nagents -= agent0; } catch (Exception e) { } } if (nagents > MAX_AGENT_FRAMES) { needMore = true; nagents = MAX_AGENT_FRAMES; } if (agent0 > 0 || nagents < totalAgents) { title = "Agents+" + ((String) agents.get(agent0)) + "+Through+" + ((String) agents.get(agent0 + nagents - 1)); } int nrows = (nagents + 2 + (needMore ? 1 : 0)) / 3; out.print("<frameset rows=\"40"); for (int row = 0; row < nrows; row++) { out.print(",100"); } out.println( "\">\n"+ "  <frame src=\""+ getEncodedAgentName()+getPath()+ "?viewType=viewTitle&title="+ getTitlePrefix()+"Completion+of+"+title+ "\" scrolling=\"no\">"); for (int row = 0; row < nrows; row++) { out.println("  <frameset cols=\"300,300,300\">"); for (int col = 0; col < 3; col++) { int agentn = agent0 + row * 3 + col; if (agentn < agent0 + nagents) { String agentName = (String) agents.get(agentn); out.println( "    <frame src=\""+ "/$"+agentName+getPath()+"?viewType=viewAgentSmall"+ "\" scrolling=\"no\">"); } else if (agentn == agent0 + nagents && needMore) { out.println( "    <frame src=\""+ "/$"+getEncodedAgentName()+getPath()+ "?viewType=viewMoreLink&firstAgent="+ (agent0 + MAX_AGENT_FRAMES) + "\" scrolling=\"no\">"); } } out.println("  </frameset>"); } out.println("</frameset>"); } out.println("<html>");
viewSelectedAgents(getAllAgentNames(), "All");
    private void viewAllAgents() throws IOException {      response.setContentType("text/html");      out = response.getWriter();      format = FORMAT_HTML;     // Force html format      List agents = getAllEncodedAgentNames();      out.println(          "<html>\n" +          "<head>\n" +          "<title>"+          getTitlePrefix()+          "Completion of All Agents</title>\n" +          "</head>");      boolean use_iframes = false;      String browser = request.getHeader("user-agent").toLowerCase();      if (browser != null) {        for (int i = 0; i < iframeBrowsers.length; i++) {          if (browser.indexOf(iframeBrowsers[i]) >= 0) {            use_iframes = true;            break;          }        }      }      if (use_iframes) {        out.println(            "<body>\n"+            "<h2><center>"+            getTitlePrefix()+            "Completion of All Agents</h2></center>");        for (int i = 0, n = agents.size(); i < n; i++) {          int col = i % 3;          String agentName = (String) agents.get(i);          out.println(              "<iframe src=\"/$" + agentName + getPath() +              "?viewType=viewAgentSmall\""+              " scrolling=\"no\" width=300 height=90>" +               agentName + "</iframe>\n"+              "</td>");        }        out.println("</body>");      } else {        int totalAgents = agents.size();        int nagents = totalAgents;        String firstAgent = request.getParameter("firstAgent");        int agent0 = 0;        boolean needMore = false;        String title = "All Agents";        if (firstAgent != null) {          try {            agent0 = Integer.parseInt(firstAgent);            if (agent0 < 0) {              agent0 = 0;            } else if (agent0 >= nagents) {              agent0 = nagents - MAX_AGENT_FRAMES;            }            nagents -= agent0;          } catch (Exception e) {          }        }        if (nagents > MAX_AGENT_FRAMES) {          needMore = true;          nagents = MAX_AGENT_FRAMES;        }        if (agent0 > 0 || nagents < totalAgents) {          title =            "Agents+" + ((String) agents.get(agent0)) +            "+Through+" + ((String) agents.get(agent0 + nagents - 1));        }        int nrows = (nagents + 2 + (needMore ? 1 : 0)) / 3;        out.print("<frameset rows=\"40");        for (int row = 0; row < nrows; row++) {          out.print(",100");        }        out.println(            "\">\n"+            "  <frame src=\""+            getEncodedAgentName()+getPath()+            "?viewType=viewTitle&title="+            getTitlePrefix()+"Completion+of+"+title+            "\" scrolling=\"no\">");        for (int row = 0; row < nrows; row++) {          out.println("  <frameset cols=\"300,300,300\">");          for (int col = 0; col < 3; col++) {            int agentn = agent0 + row * 3 + col;            if (agentn < agent0 + nagents) {              String agentName = (String) agents.get(agentn);              out.println(                  "    <frame src=\""+                  "/$"+agentName+getPath()+"?viewType=viewAgentSmall"+                  "\" scrolling=\"no\">");            } else if (agentn == agent0 + nagents && needMore) {              out.println(                  "    <frame src=\""+                  "/$"+getEncodedAgentName()+getPath()+                  "?viewType=viewMoreLink&firstAgent="+                  (agent0 + MAX_AGENT_FRAMES) +                  "\" scrolling=\"no\">");            }          }          out.println("  </frameset>");        }        out.println("</frameset>");      }      out.println("<html>");    }