Example usage for com.vaadin.client UIDL getChildUIDL

List of usage examples for com.vaadin.client UIDL getChildUIDL

Introduction

In this page you can find the example usage for com.vaadin.client UIDL getChildUIDL.

Prototype

public native UIDL getChildUIDL(int i)
;

Source Link

Document

Gets the UIDL for the child at the given index.

Usage

From source file:org.vaadin.tltv.multiscrolltable.client.ui.ContentPanel.java

License:Apache License

public void updateContent(UIDL uidl) {
    if (uidl == null) {
        return;/* ww  w. ja  v a  2 s  .co m*/
    }

    int rowCount = uidl.getChildCount();
    int columnCount = (headerContainer != null) ? headerContainer.getColumnCount() : 0;
    if (rowCount == 0 || columnCount == 0) {
        return;
    }

    for (int i = 0; i < rowCount; i++) {
        UIDL rowUidl = uidl.getChildUIDL(i);

        Row row = rowContainer.createRow(i, rowUidl);
    }

    updateRowContentTop();
    setInternalContentTop();

    int[] widths = calculateMinWidthsForColumns(rowContainer.getRows());
    // Update headerContainer column widths by the cell widths
    if (headerContainer != null) {
        widths = headerContainer.setColumnMinWidths(widths);
        setColumnMinWidths(rowContainer.getRows(), widths);
    }

    rowContainer.setReConstruct(false);
}

From source file:org.vaadin.tltv.multiscrolltable.client.ui.DefaultRowContainer.java

License:Apache License

@Override
public Row createRow(int rowIndex, UIDL rowUidl) {
    Row row = getRow(rowIndex);//from  ww  w  . j  av a 2  s.c  o  m

    int actualColIndex = 0;
    int startIndex = headerContainer.getFirstColIndexForRowsUidl();
    for (int colIndex = startIndex; colIndex < (startIndex
            + headerContainer.getColumnCount()); colIndex++, actualColIndex++) {
        UIDL columnUIDL = rowUidl.getChildUIDL(colIndex);

        Cell cell = getCell(actualColIndex, row);

        cell.setValue(columnUIDL.getChildString(0));
    }
    return row;
}

From source file:org.vaadin.tltv.multiscrolltable.client.ui.HeaderPanel.java

License:Apache License

public void updateContent(UIDL uidl) {
    if (uidl == null) {
        return;//from   w ww.ja  v  a  2 s .  com
    }

    if (uidl.getTag().equals(VCustomScrollTable.TAG_SCROLLCONTENT)) {
        int childcount = uidl.getChildCount();
        if (childcount > 0) {
            ColumnPanel prev = null;
            for (int i = 0; i < childcount; i++) {
                prev = updateContentByGroupUidl(uidl.getChildUIDL(i), 0, i, prev, null);
            }
        }

    }

    if (reConstruct) {
        columnCount = 0;
        if (content.getRowCount() > 0) {
            columnCount = content.getCellCount(content.getRowCount() - 1);
        }
    }
    reConstruct = false;
}

From source file:org.vaadin.tltv.multiscrolltable.client.ui.HeaderPanel.java

License:Apache License

private ColumnPanel updateContentByGroupUidl(UIDL uidl, int level, int index, ColumnPanel prevColumn,
        ColumnPanel group) {/* w w  w .j a v a  2s  .  c o m*/
    if (uidl == null) {
        return null;
    }

    String caption = uidl.getStringAttribute(VCustomScrollTable.ATTR_CAPTION);
    ColumnPanel p = getColumnPanel(level, index, prevColumn, group);
    updateGroupElement(p);
    p.getLabel().setText(caption);

    boolean updateColSpan = false;
    int childs = uidl.getChildCount();
    if (childs <= 0) {
        return p;
    }
    int cellCount = p.getFirstChildIndex();
    if (reConstruct) {
        // When reconstructing, p.getFirstChildIndex() value is not updated
        // yet.
        try {
            cellCount = content.getCellCount(level + 1);
        } catch (IndexOutOfBoundsException e) {
            cellCount = 0;
        }
    }
    ColumnPanel prev = null;
    for (int i = 0; i < childs; i++) {
        UIDL subUidl = uidl.getChildUIDL(i);
        if (subUidl.getTag().equals(VCustomScrollTable.TAG_COLUMN)) {
            prev = updateContentByColumnUidl(subUidl, level + 1, cellCount + i, prev, p);
            updateColSpan = reConstruct;
        } else if (subUidl.getTag().equals(VCustomScrollTable.TAG_COLUMNGROUP)) {
            prev = updateContentByGroupUidl(subUidl, level + 1, i, prev, p);
        }
    }
    if (updateColSpan) {
        // This needs to be called only for the "leaf" panels.
        p.setColSpan(childs);
    }
    return p;
}