Package com.google.gwt.dom.client

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


            boolean alignImageToEvent) {
        Element cloneNode = (Element) element.cloneNode(true);
        syncContent(element, cloneNode);
        if (BrowserInfo.get().isIE()) {
            if (cloneNode.getTagName().toLowerCase().equals("tr")) {
                TableElement table = Document.get().createTableElement();
                TableSectionElement tbody = Document.get().createTBodyElement();
                table.appendChild(tbody);
                tbody.appendChild(cloneNode);
                cloneNode = table.cast();
            }
        }
        if (alignImageToEvent) {
            int absoluteTop = element.getAbsoluteTop();
            int absoluteLeft = element.getAbsoluteLeft();
View Full Code Here


    Element e = Document.get().getElementById(id);

    assertTrue("table".equalsIgnoreCase(e.getNodeName()),
        "Table Element with id " + id + " doesn't exist.");

    TableElement te = TableElement.as(e);
    TableSectionElement thead = te.getTHead();
    assertNotNull(thead, "Table must contain THEAD element");
    NodeList<TableRowElement> hrows = thead.getRows();
    assertTrue(hrows.getLength() == 1, "Table THEAD must contain 1 TR element");

    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);
View Full Code Here

    messageDiv.setId(lastMsgID);
    messageDiv.setClassName("selected-article");
   
    //create the avatar table
    element = DOM.createTable();
    TableElement avatarTable = TableElement.as(element);
    messageDiv.appendChild(avatarTable);
    avatarTable.setAttribute("hspace", "4");
    avatarTable.setAttribute("cellspacing","0");
    avatarTable.setAttribute("vspace", "2");
    avatarTable.setAttribute("border", "0");
    avatarTable.setAttribute("align", "left");
   
    Element tbodyElement = DOM.createTBody();
    avatarTable.appendChild(tbodyElement);
   
    Element trElement = DOM.createTR();
    tbodyElement.appendChild(trElement);
   
    Element tdElement = DOM.createTD();
    trElement.appendChild(tdElement);
    tdElement.setAttribute("height", "45");
    tdElement.setAttribute("width", "45");
    tdElement.setAttribute("align", "middle");
    Style style = tdElement.getStyle();
    style.setProperty("border", "1px solid black");
    style.setProperty("background-color", "white");
   
    Element imgElement = DOM.createImg();
    ImageElement imageElement = ImageElement.as(imgElement);
    tdElement.appendChild(imageElement);
    imageElement.setAttribute("height", "45");
    imageElement.setAttribute("widht", "45");
    XmppVCard vc = null;
    if(local)
      vc = JabberApp.instance().getSelfVCard();
    else
      vc = vcard;
    if(!GXT.isIE&&vc != null&&!vc.photo().isEmpty())
      imageElement.setSrc("data:image;base64,"+vc.photo());
    else
      imageElement.setSrc("images/default_avatar.png");
   
    tdElement = DOM.createTD();
    tdElement.setInnerHTML("&nbsp&nbsp");
    trElement.appendChild(tdElement);
   
    //create the div for timestamp and nick
    element = DOM.createDiv();
    DivElement tnDiv = DivElement.as(element);
    tnDiv.setClassName("msg_header");
    messageDiv.appendChild(tnDiv);
    //style = tnDiv.getStyle();
    //style.setProperty("border-bottom", "1px solid black");
   
    element = DOM.createTable();
    TableElement tnTableElement = TableElement.as(element);
    tnDiv.appendChild(tnTableElement);
    tnTableElement.setAttribute("cellspacing", "0");
    tnTableElement.setAttribute("cellpadding", "0");
    tnTableElement.setAttribute("width", "80%");
    tnTableElement.setAttribute("border", "0");
   
    tbodyElement = DOM.createTBody();
    tnTableElement.appendChild(tbodyElement);
   
    trElement = DOM.createTR();
    tbodyElement.appendChild(trElement);
   
    Element nickElement = DOM.createTD();
View Full Code Here

    messageDiv.setId(lastMsgID);
    messageDiv.setClassName("selected-article");
   
    //create the avatar table
    element = DOM.createTable();
    TableElement avatarTable = TableElement.as(element);
    messageDiv.appendChild(avatarTable);
    avatarTable.setAttribute("hspace", "4");
    avatarTable.setAttribute("cellspacing","0");
    avatarTable.setAttribute("vspace", "2");
    avatarTable.setAttribute("border", "0");
    avatarTable.setAttribute("align", "left");
   
    Element tbodyElement = DOM.createTBody();
    avatarTable.appendChild(tbodyElement);
   
    Element trElement = DOM.createTR();
    tbodyElement.appendChild(trElement);
   
    Element tdElement = DOM.createTD();
    trElement.appendChild(tdElement);
    tdElement.setAttribute("height", "45");
    tdElement.setAttribute("width", "45");
    tdElement.setAttribute("align", "middle");
    Style style = tdElement.getStyle();
    style.setProperty("border", "1px solid black");
    style.setProperty("background-color", "white");
   
    Element imgElement = DOM.createImg();
    ImageElement imageElement = ImageElement.as(imgElement);
    tdElement.appendChild(imageElement);
    imageElement.setAttribute("height", "45");
    imageElement.setAttribute("widht", "45");
    XmppVCard vc = null;
    if(local)
      vc = JabberApp.instance().getSelfVCard();
    else
      vc = vcard;
    if(!GXT.isIE&&vc != null&&!vc.photo().isEmpty())
      imageElement.setSrc("data:image;base64,"+vc.photo());
    else
      imageElement.setSrc(JabberApp.instance().getAvatarUrl(jid));
   
    tdElement = DOM.createTD();
    tdElement.setInnerHTML("&nbsp&nbsp");
    trElement.appendChild(tdElement);
   
    //create the div for timestamp and nick
    element = DOM.createDiv();
    DivElement tnDiv = DivElement.as(element);
    tnDiv.setClassName("msg_header");
    messageDiv.appendChild(tnDiv);
    //style = tnDiv.getStyle();
    //style.setProperty("border-bottom", "1px solid black");
   
    element = DOM.createTable();
    TableElement tnTableElement = TableElement.as(element);
    tnDiv.appendChild(tnTableElement);
    tnTableElement.setAttribute("cellspacing", "0");
    tnTableElement.setAttribute("cellpadding", "0");
    tnTableElement.setAttribute("width", "80%");
    tnTableElement.setAttribute("border", "0");
   
    tbodyElement = DOM.createTBody();
    tnTableElement.appendChild(tbodyElement);
   
    trElement = DOM.createTR();
    tbodyElement.appendChild(trElement);
   
    Element nickElement = DOM.createTD();
View Full Code Here

        widgetDIV = Document.get().createDivElement();
        if (BrowserInfo.get().isFF2()) {
            // Style style = widgetDIV.getStyle();
            // FF2 chokes on some floats very easily. Measuring size escpecially
            // becomes terribly slow
            TableElement tableEl = Document.get().createTableElement();
            tableEl.setInnerHTML("<tbody><tr><td><div></div></td></tr></tbody>");
            DivElement div = (DivElement) tableEl.getFirstChildElement()
                    .getFirstChildElement().getFirstChildElement()
                    .getFirstChildElement();
            tableEl.setCellPadding(0);
            tableEl.setCellSpacing(0);
            tableEl.setBorder(0);
            div.getStyle().setProperty("padding", "0");

            setElement(tableEl);
            containerDIV = div;
        } else {
View Full Code Here

      // generate the entire table.
      sectionTag = sectionTag.toLowerCase();
      String innerHtml = "<table><" + sectionTag + ">" + rowHtml + "</"
          + sectionTag + "></table>";
      tmpElem.setInnerHTML(innerHtml);
      TableElement tableElem = tmpElem.getFirstChildElement().cast();

      // Get the section out of the table.
      if ("tbody".equals(sectionTag)) {
        return tableElem.getTBodies().getItem(0);
      } else if ("thead".equals(sectionTag)) {
        return tableElem.getTHead();
      } else if ("tfoot".equals(sectionTag)) {
        return tableElem.getTFoot();
      }
      throw new IllegalArgumentException("Invalid table section tag: "
          + sectionTag);
    }
View Full Code Here

        widgetDIV = Document.get().createDivElement();
        if (BrowserInfo.get().isFF2()) {
            Style style = widgetDIV.getStyle();
            // FF2 chokes on some floats very easily. Measuring size escpecially
            // becomes terribly slow
            TableElement tableEl = Document.get().createTableElement();
            tableEl.setInnerHTML("<tbody><tr><td><div></div></td></tr></tbody>");
            DivElement div = (DivElement) tableEl.getFirstChildElement()
                    .getFirstChildElement().getFirstChildElement()
                    .getFirstChildElement();
            tableEl.setCellPadding(0);
            tableEl.setCellSpacing(0);
            tableEl.setBorder(0);
            div.getStyle().setProperty("padding", "0");

            setElement(tableEl);
            containerDIV = div;
        } else {
View Full Code Here

        tmpElem.setInnerHTML(template.tfoot(rowHtml).asString());
      } else {
        throw new IllegalArgumentException("Invalid table section tag: "
            + sectionTag);
      }
      TableElement tableElem = tmpElem.getFirstChildElement().cast();

      // Detach the event listener.
      DOM.setEventListener(tmpElem, null);

      // Get the section out of the table.
      if ("tbody".equals(sectionTag)) {
        return tableElem.getTBodies().getItem(0);
      } else if ("thead".equals(sectionTag)) {
        return tableElem.getTHead();
      } else if ("tfoot".equals(sectionTag)) {
        return tableElem.getTFoot();
      } else {
        throw new IllegalArgumentException("Invalid table section tag: "
            + sectionTag);
      }
    }
View Full Code Here

      } else if ("tfoot".equals(sectionTag)) {
        tmpElem.setInnerHTML(template.tfoot(rowHtml).asString());
      } else {
        throw new IllegalArgumentException("Invalid table section tag: " + sectionTag);
      }
      TableElement tableElem = tmpElem.getFirstChildElement().cast();

      // Detach the event listener.
      DOM.setEventListener(tmpElem, null);

      // Get the section out of the table.
      if ("tbody".equals(sectionTag)) {
        return tableElem.getTBodies().getItem(0);
      } else if ("thead".equals(sectionTag)) {
        return tableElem.getTHead();
      } else if ("tfoot".equals(sectionTag)) {
        return tableElem.getTFoot();
      } else {
        throw new IllegalArgumentException("Invalid table section tag: " + sectionTag);
      }
    }
View Full Code Here

     */
    private void replaceTableSection(AbstractCellTable<?> table, TableSectionElement section,
        SafeHtml html) {
      String sectionName = section.getTagName().toLowerCase();
      TableSectionElement newSection = convertToSectionElement(table, sectionName, html);
      TableElement tableElement = table.getElement().cast();
      tableElement.replaceChild(newSection, section);
      if ("tbody".equals(sectionName)) {
        ((TableSectionChangeHandler) table).onTableBodyChange(newSection);
      } else if ("thead".equals(sectionName)) {
        ((TableSectionChangeHandler) table).onTableHeadChange(newSection);
      } else if ("tfoot".equals(sectionName)) {
View Full Code Here

TOP

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

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.