Example #1
0
 public static void store(String text) {
   Document doc = Global.window.document;
   Image img = (Image) Global.window.document.getElementById("image");
   if (img == null) {
     img = (Image) Global.window.document.createElement("img");
     Global.window.document.body.appendChild(img);
   }
   img.setAttribute("id", "image");
   img.setAttribute("src", text);
   img.setAttribute("onload", "cwt.ImageLibrary.push()");
   img.setAttribute("style", "display:none");
 }
 private static void openGroup(TableRow row, HTMLCollection<TableRow> rows) {
   String row1Property = row.getAttribute("data-forProperty");
   for (int i = row.rowIndex + 1; i < rows.length; i++) {
     TableRow row2 = rows.$get(i);
     Image openClose = NextGlobalJs.next.dom.getInnerElementById(row2, "openCloseBtn");
     openClose.src = application + OPEN;
     openClose.setAttribute("data-open", "false");
     String row2Property = row2.getAttribute("data-forProperty");
     if (row2Property.length() > row1Property.length() + 1) {
       String base = row2Property.substring(0, row1Property.length() + 1);
       if (base.equals(row1Property + ".")) {
         if (row2Property.substring(base.length()).indexOf('.') > 0) {
           continue;
         }
         row2.style.display = "";
       } else {
         break;
       }
     } else {
       break;
     }
   }
 }
 private static void installOpenCloseButton(
     final Image openClose, final TableRow row, final HTMLCollection<TableRow> rows) {
   openClose.onclick =
       new Function1<DOMEvent, Boolean>() {
         public Boolean $invoke(DOMEvent p1) {
           String open = openClose.getAttribute("data-open");
           if (open == null || "false".equals(open)) {
             openClose.src = application + CLOSE;
             openGroup(row, rows);
             openClose.setAttribute("data-open", "true");
           } else {
             openClose.src = application + OPEN;
             colapseGroup(row, rows);
             openClose.setAttribute("data-open", "false");
           }
           return null;
         }
       };
 }