Example #1
0
 public static void initializeNavBar() {
   StringBuilder sb = new StringBuilder();
   for (String s : _navbarOrdering) {
     ArrayList<MenuItem> arl = _navbar.get(s);
     if ((arl.size() == 1) && arl.get(0)._name.equals(s)) {
       arl.get(0).toHTML(sb);
     } else {
       sb.append("<li class='dropdown'>");
       sb.append("<a href='#' class='dropdown-toggle' data-toggle='dropdown'>");
       sb.append(s);
       sb.append("<b class='caret'></b>");
       sb.append("</a>");
       sb.append("<ul class='dropdown-menu'>");
       for (MenuItem i : arl) i.toHTML(sb);
       sb.append("</ul></li>");
     }
   }
   RString str = new RString(_htmlTemplate);
   str.replace("NAVBAR", sb.toString());
   str.replace("CONTENTS", "%CONTENTS");
   _htmlTemplate = str.toString();
 }
Example #2
0
 /** Return the query link to this page */
 public static String link(Key k, String content) {
   RString rs = new RString("<a href='/2/GBM.query?source=%$key'>%content</a>");
   rs.replace("key", k.toString());
   rs.replace("content", content);
   return rs.toString();
 }
Example #3
0
 protected NanoHTTPD.Response wrap(NanoHTTPD server, String response) {
   RString html = new RString(_htmlTemplate);
   html.replace("CONTENTS", response);
   return server.new Response(NanoHTTPD.HTTP_OK, NanoHTTPD.MIME_HTML, html.toString());
 }