Package com.google.gwt.dom.client

Examples of com.google.gwt.dom.client.TableRowElement


                    // no rows yet rendered
                    return 0;
                }
                for (Widget row : renderedRows) {
                    if (!(row instanceof VScrollTableGeneratedRow)) {
                        TableRowElement tr = row.getElement().cast();
                        Element wrapperdiv = tr.getCells().getItem(columnIndex)
                                .getFirstChildElement().cast();
                        return wrapperdiv.getOffsetWidth();
                    }
                }
                return 0;
View Full Code Here


                tBodyElement.appendChild(scrollTableRow.getElement());
                detectExtrawidth();
                tBodyElement.removeChild(scrollTableRow.getElement());
            } else {
                boolean noCells = false;
                TableRowElement item = rows.getItem(0);
                TableCellElement firstTD = item.getCells().getItem(0);
                if (firstTD == null) {
                    // content is currently empty, we need to add a fake cell
                    // for measuring
                    noCells = true;
                    VScrollTableRow next = (VScrollTableRow) iterator().next();
                    boolean sorted = tHead.getHeaderCell(0) != null ? tHead
                            .getHeaderCell(0).isSorted() : false;
                    next.addCell(null, "", ALIGN_LEFT, "", true, sorted);
                    firstTD = item.getCells().getItem(0);
                }
                com.google.gwt.dom.client.Element wrapper = firstTD
                        .getFirstChildElement();
                cellExtraWidth = firstTD.getOffsetWidth()
                        - wrapper.getOffsetWidth();
View Full Code Here

    int numCols = 0;

    DataTable table = DataTable.create();

    if (hrows.getLength() == 1) {
      TableRowElement tr = hrows.getItem(0);
      NodeList<TableCellElement> hcols = tr.getCells();
      assertTrue(hcols.getLength() > 1,
          "THEAD TR contains less than 2 columns");
      for (int i = 0; i < hcols.getLength(); i++) {
        TableCellElement th = hcols.getItem(i);
        assertTrue("th".equalsIgnoreCase(th.getNodeName()),
            "Only TH elements should occur in THEAD TR");
        String title = th.getInnerText().trim();
        numCols++;
        if (i == 0) {
          table.addColumn("date", title);
        } else {
          if ("markers".equalsIgnoreCase(title)) {
            table.addColumn("string", title);
          } else {
            table.addColumn("number", title);
          }
        }
      }
    } else {
      throw new JavaScriptException("Table Element must ");
    }

    String dateFormat = "MM-dd-yy";
    NumberFormat numberFormats[] = new NumberFormat[numCols];

    NodeList<Element> colGroup = te.getElementsByTagName("colgroup");
    assertTrue(colGroup != null && colGroup.getLength() == 1,
        "Table must have exactly one COLGROUP element");

    NodeList<Element> cols = colGroup.getItem(0).getElementsByTagName("col");
    assertTrue(cols != null && cols.getLength() == numCols,
        "COLGROUP must have one COL element for each TH in THEAD");

    for (int i = 0; i < cols.getLength(); i++) {
      Element col = cols.getItem(i);
      String fmt = col.getAttribute("title");
      String className = col.getClassName();
      if (i == 0) {
        assertTrue(fmt != null && !"".equals(fmt),
            "COL for column 0 must have TITLE attribute containing date");
        assertTrue("cmf-dateformat".equals(className),
            "COL for column 0 must have CLASS of cmf-dateformat");
      }
      if (i == 0) {
        dateFormat = fmt;
      } else {
        if (fmt != null && !"".equals(fmt)) {
          assertTrue("cmf-numberformat".equals(className),
              "Number format COL elements must have class of cmf-numberformat with title containing format according to GWT NumberFormat syntax at http://google-web-toolkit.googlecode.com/svn/javadoc/1.4/com/google/gwt/i18n/client/NumberFormat.html");
          numberFormats[i] = NumberFormat.getFormat(fmt);
        } else if ("cmf-numberformat".equals(className)) {
          assertTrue(fmt != null && !"".equals(fmt),
              "COL has class cmf-numberformat but missing title attribute with format string with syntax http://google-web-toolkit.googlecode.com/svn/javadoc/1.4/com/google/gwt/i18n/client/NumberFormat.html");
          numberFormats[i] = NumberFormat.getFormat(fmt);
        }
      }
    }

    NodeList<TableSectionElement> tbodies = te.getTBodies();
    assertNotNull(tbodies, "Table must contain TBODY elements");
    assertTrue(tbodies.getLength() > 0, "Table must contain TBODY elements");
    int totalAdded = 0;
    for (int i = 0; i < tbodies.getLength(); i++) {
      TableSectionElement tbody = tbodies.getItem(i);
      NodeList<TableRowElement> drows = tbody.getRows();
      table.addRows(drows.getLength());
      for (int j = 0; j < drows.getLength(); j++) {
        TableRowElement row = drows.getItem(j);
        NodeList<TableCellElement> cells = row.getCells();
        assertTrue(cells.getLength() == numCols,
            "Number of TH header columns in THEAD must match number of TD columns in TBODY");

        for (int k = 0; k < cells.getLength(); k++) {
          TableCellElement cell = cells.getItem(k);
View Full Code Here

   public TableRowElement getRowForItem(FindResult entry)
   {
      if (entry == null)
      {
         // Overflow message
         TableRowElement tr = Document.get().createTRElement();
         TableCellElement td = Document.get().createTDElement();
         td.setClassName(styles_.overflowWarning());
         td.setColSpan(2);
         td.setInnerText("More than 1000 matching lines were found. " +
                         "Only the first 1000 lines are shown.");
         tr.appendChild(td);
         return tr;
      }

      TableRowElement tr = Document.get().createTRElement();
      tr.setAttribute(DATA_FILE, entry.getFile());
      tr.setAttribute(DATA_LINE, entry.getLine() + "");

      TableCellElement td1 = Document.get().createTDElement();
      td1.setClassName(styles_.line());
      td1.setInnerText(entry.getLine() + ":\u00A0");
      tr.appendChild(td1);

      TableCellElement td2 = Document.get().createTDElement();
      td2.setClassName(styles_.lineValue());
      td2.setInnerHTML(entry.getLineHTML().asString());
      tr.appendChild(td2);

      return tr;
   }
View Full Code Here

   }

   @Override
   protected int addBreak(TableRowElement row)
   {
      TableRowElement tr = Document.get().createTRElement();
      tr.setClassName(styles_.headerRow());

      TableCellElement td = Document.get().createTDElement();
      td.setColSpan(2);
      td.setInnerText(row.getAttribute(DATA_FILE));
      tr.appendChild(td);

      row.getParentElement().insertBefore(tr, row);
      return 1;
   }
View Full Code Here

      }
   }

   public void addRecentCommands(ArrayList<HistoryEntry> entries, boolean top)
   {
      TableRowElement topRow = null;
      if (top)
         topRow = commandList_.getTopRow();

      commandList_.addItems(entries, top);

      if (top)
      {
         if (topRow == null)
            recentScrollPanel_.scrollToBottom();
         else
            recentScrollPanel_.setVerticalScrollPosition(topRow.getOffsetTop());
      }
      else
         recentScrollPanel_.onContentSizeChanged();
   }
View Full Code Here

        // element.
        Element trElem = tableCell.getParentElement();
        if (trElem == null) {
            return -1;
        }
        TableRowElement tr = TableRowElement.as(trElem);
        Element sectionElem = tr.getParentElement();
        if (sectionElem == null) {
            return -1;
        }

        int row = tr.getSectionRowIndex();
        return row;

    }
View Full Code Here

                    // no rows yet rendered
                    return 0;
                }
                for (Widget row : renderedRows) {
                    if (!(row instanceof VScrollTableGeneratedRow)) {
                        TableRowElement tr = row.getElement().cast();
                        Element wrapperdiv = tr.getCells().getItem(columnIndex)
                                .getFirstChildElement().cast();
                        return wrapperdiv.getOffsetWidth();
                    }
                }
                return 0;
View Full Code Here

                tBodyElement.appendChild(scrollTableRow.getElement());
                detectExtrawidth();
                tBodyElement.removeChild(scrollTableRow.getElement());
            } else {
                boolean noCells = false;
                TableRowElement item = rows.getItem(0);
                TableCellElement firstTD = item.getCells().getItem(0);
                if (firstTD == null) {
                    // content is currently empty, we need to add a fake cell
                    // for measuring
                    noCells = true;
                    VScrollTableRow next = (VScrollTableRow) iterator().next();
                    boolean sorted = tHead.getHeaderCell(0) != null ? tHead
                            .getHeaderCell(0).isSorted() : false;
                    next.addCell(null, "", ALIGN_LEFT, "", true, sorted);
                    firstTD = item.getCells().getItem(0);
                }
                com.google.gwt.dom.client.Element wrapper = firstTD
                        .getFirstChildElement();
                cellExtraWidth = firstTD.getOffsetWidth()
                        - wrapper.getOffsetWidth();
View Full Code Here

    setStyleName(this.style.cellTable());

    // Create the loading indicator.
    {
      TableCellElement td = Document.get().createTDElement();
      TableRowElement tr = Document.get().createTRElement();
      tbodyLoading.appendChild(tr);
      tr.appendChild(td);
      td.setAlign("center");
      td.setInnerHTML("<div class='" + style.loading() + "'></div>");
    }

    // Create the implementation.
View Full Code Here

TOP

Related Classes of com.google.gwt.dom.client.TableRowElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.