Package com.vaadin.terminal.gwt.client.ui.VScrollTable.VScrollTableBody

Examples of com.vaadin.terminal.gwt.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow


            // FIXME REVIEW
            aligns = tHead.getColumnAlignments();
            final Iterator<?> it = rowData.getChildIterator();
            if (firstIndex == lastRendered + 1) {
                while (it.hasNext()) {
                    final VScrollTableRow row = prepareRow((UIDL) it.next());
                    addRow(row);
                    setLastRendered(lastRendered + 1);
                }
                fixSpacers();
            } else if (firstIndex + rows == firstRendered) {
                final VScrollTableRow[] rowArray = new VScrollTableRow[rows];
                int i = rows;
                while (it.hasNext()) {
                    i--;
                    rowArray[i] = prepareRow((UIDL) it.next());
                }
                for (i = 0; i < rows; i++) {
                    addRowBeforeFirstRendered(rowArray[i]);
                    firstRendered--;
                }
            } else {
                // completely new set of rows

                // there can't be sanity checks for last rendered within this
                // while loop regardless of what has been set previously, so
                // change it temporarily to true and then return the original
                // value
                boolean temp = postponeSanityCheckForLastRendered;
                postponeSanityCheckForLastRendered = true;
                while (lastRendered + 1 > firstRendered) {
                    unlinkRow(false);
                }
                postponeSanityCheckForLastRendered = temp;
                VScrollTableRow row = prepareRow((UIDL) it.next());
                firstRendered = firstIndex;
                setLastRendered(firstIndex - 1);
                addRow(row);
                setLastRendered(lastRendered + 1);
                setContainerHeight();
View Full Code Here


            final Iterator<?> it = rowData.getChildIterator();
            List<VScrollTableRow> insertedRows = new ArrayList<VScrollTableRow>();

            if (firstIndex == lastRendered + 1) {
                while (it.hasNext()) {
                    final VScrollTableRow row = prepareRow((UIDL) it.next());
                    addRow(row);
                    insertedRows.add(row);
                    if (postponeSanityCheckForLastRendered) {
                        lastRendered++;
                    } else {
                        setLastRendered(lastRendered + 1);
                    }
                }
                fixSpacers();
            } else if (firstIndex + rows == firstRendered) {
                final VScrollTableRow[] rowArray = new VScrollTableRow[rows];
                int i = rows;
                while (it.hasNext()) {
                    i--;
                    rowArray[i] = prepareRow((UIDL) it.next());
                }
                for (i = 0; i < rows; i++) {
                    addRowBeforeFirstRendered(rowArray[i]);
                    insertedRows.add(rowArray[i]);
                    firstRendered--;
                }
            } else {
                // insert in the middle
                int ix = firstIndex;
                while (it.hasNext()) {
                    VScrollTableRow row = prepareRow((UIDL) it.next());
                    insertRowAt(row, ix);
                    insertedRows.add(row);
                    if (postponeSanityCheckForLastRendered) {
                        lastRendered++;
                    } else {
View Full Code Here

                    rows);
            int actualIxOfFirstRowAfterInserted = firstIndex + rows
                    - firstRendered;
            for (int ix = actualIxOfFirstRowAfterInserted; ix < renderedRows
                    .size(); ix++) {
                VScrollTableRow r = (VScrollTableRow) renderedRows.get(ix);
                r.setIndex(r.getIndex() + rows);
            }
            setContainerHeight();
            return inserted;
        }
View Full Code Here

         * This method can be called only after table has been initialized
         *
         * @param uidl
         */
        private VScrollTableRow prepareRow(UIDL uidl) {
            final VScrollTableRow row = createRow(uidl, aligns);
            row.initCellWidths();
            return row;
        }
View Full Code Here

        protected VScrollTableRow createRow(UIDL uidl, char[] aligns2) {
            if (uidl.hasAttribute("gen_html")) {
                // This is a generated row.
                return new VScrollTableGeneratedRow(uidl, aligns2);
            }
            return new VScrollTableRow(uidl, aligns2);
        }
View Full Code Here

            row.setIndex(index);
            if (row.isSelected()) {
                row.addStyleName("v-selected");
            }
            if (index > 0) {
                VScrollTableRow sibling = getRowByRowIndex(index - 1);
                tBodyElement
                        .insertAfter(row.getElement(), sibling.getElement());
            } else {
                VScrollTableRow sibling = getRowByRowIndex(index);
                tBodyElement.insertBefore(row.getElement(),
                        sibling.getElement());
            }
            adopt(row);
            int actualIx = index - firstRendered;
            renderedRows.add(actualIx, row);
        }
View Full Code Here

        protected void unlinkAndReindexRows(int firstIndex, int count) {
            unlinkRows(firstIndex, count);
            int actualFirstIx = firstIndex - firstRendered;
            for (int ix = actualFirstIx; ix < renderedRows.size(); ix++) {
                VScrollTableRow r = (VScrollTableRow) renderedRows.get(ix);
                r.setIndex(r.getIndex() - count);
            }
            setContainerHeight();
        }
View Full Code Here

        private int actualIndex(int index) {
            return index - firstRendered;
        }

        private void unlinkRowAtActualIndex(int index) {
            final VScrollTableRow toBeRemoved = (VScrollTableRow) renderedRows
                    .get(index);
            // Unregister row tooltip
            client.registerTooltip(VScrollTable.this, toBeRemoved.getElement(),
                    null);
            for (int i = 0; i < toBeRemoved.getElement().getChildCount(); i++) {
                // Unregister cell tooltips
                Element td = toBeRemoved.getElement().getChild(i).cast();
                client.registerTooltip(VScrollTable.this, td, null);
            }
            lazyUnregistryBag.add(toBeRemoved);
            tBodyElement.removeChild(toBeRemoved.getElement());
            orphan(toBeRemoved);
            renderedRows.remove(index);
        }
View Full Code Here

                            getTableHeight();
                        }
                        rowHeight = lastKnownRowHeight;
                    } else if (isAttached()) {
                        // measure row height by adding a dummy row
                        VScrollTableRow scrollTableRow = new VScrollTableRow();
                        tBodyElement.appendChild(scrollTableRow.getElement());
                        getRowHeight(forceUpdate);
                        tBodyElement.removeChild(scrollTableRow.getElement());
                    } else {
                        // TODO investigate if this can never happen anymore
                        return DEFAULT_ROW_HEIGHT;
                    }
                }
View Full Code Here

        private void detectExtrawidth() {
            NodeList<TableRowElement> rows = tBodyElement.getRows();
            if (rows.getLength() == 0) {
                /* need to temporary add empty row and detect */
                VScrollTableRow scrollTableRow = new VScrollTableRow();
                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()
View Full Code Here

TOP

Related Classes of com.vaadin.terminal.gwt.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow

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.