Example usage for com.vaadin.server PaintTarget addText

List of usage examples for com.vaadin.server PaintTarget addText

Introduction

In this page you can find the example usage for com.vaadin.server PaintTarget addText.

Prototype

void addText(String text) throws PaintException;

Source Link

Document

Adds text node.

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.CubaGroupTable.java

License:Apache License

protected void paintGroupAggregation(PaintTarget target, Object groupId, Map<Object, Object> aggregations)
        throws PaintException {
    boolean paintGroupProperty = false;

    final Collection groupProperties = getGroupProperties();
    final Object groupProperty = getGroupProperty(groupId);

    for (final Object columnId : visibleColumns) {
        if (columnId == null || isColumnCollapsed(columnId)) {
            continue;
        }/*ww  w .j a va2 s  .  com*/

        if (groupProperties.contains(columnId) && !paintGroupProperty) {
            if (columnId.equals(groupProperty)) {
                paintGroupProperty = true;
            }
            continue;
        }

        if (getCellStyleGenerator() != null) {
            String cellStyle = getCellStyleGenerator().getStyle(this, null, columnId);
            if (cellStyle != null && !cellStyle.equals("")) {
                target.addAttribute("style-" + columnIdMap.key(columnId), cellStyle + "-ag");
            }
        }

        String value = (String) aggregations.get(columnId);
        if (value != null) {
            target.addText(value);
        } else {
            target.addText("");
        }
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.CubaTable.java

License:Apache License

protected void paintAggregationRow(PaintTarget target, Map<Object, Object> aggregations) throws PaintException {
    target.startTag("arow");
    for (final Object columnId : visibleColumns) {
        if (columnId == null || isColumnCollapsed(columnId)) {
            continue;
        }// w ww.  ja v a2s  .  c  om

        if (getCellStyleGenerator() != null) {
            String cellStyle = getCellStyleGenerator().getStyle(this, null, columnId);
            if (cellStyle != null && !cellStyle.equals("")) {
                target.addAttribute("style-" + columnIdMap.key(columnId), cellStyle + "-ag");
            }
        }

        String value = (String) aggregations.get(columnId);
        target.addText(value);
    }
    target.endTag("arow");
}

From source file:com.haulmont.cuba.web.widgets.CubaGroupTable.java

License:Apache License

protected void paintGroupAggregation(PaintTarget target, Object groupId, Map<Object, Object> aggregations)
        throws PaintException {
    boolean paintGroupProperty = false;

    Collection groupProperties = getGroupProperties();
    Object groupProperty = getGroupProperty(groupId);

    for (Object columnId : _visibleColumns()) {
        if (columnId == null || isColumnCollapsed(columnId)) {
            continue;
        }//from www  . j ava  2 s.  c o m

        if (groupProperties.contains(columnId) && !paintGroupProperty) {
            if (columnId.equals(groupProperty)) {
                paintGroupProperty = true;
            }
            continue;
        }

        if (getCellStyleGenerator() != null) {
            String cellStyle = getCellStyleGenerator().getStyle(this, null, columnId);
            if (cellStyle != null && !cellStyle.isEmpty()) {
                target.addAttribute("style-" + _columnIdMap().key(columnId), cellStyle + "-ag");
            }
        }

        String value = (String) aggregations.get(columnId);
        if (value != null) {
            target.addText(value);
        } else {
            target.addText("");
        }
    }
}

From source file:com.haulmont.cuba.web.widgets.CubaTable.java

License:Apache License

protected void paintAggregationRow(PaintTarget target, Map<Object, Object> aggregations) throws PaintException {
    target.startTag("arow");
    for (final Object columnId : _visibleColumns()) {
        if (columnId == null || isColumnCollapsed(columnId)) {
            continue;
        }/*from w  ww  .ja v a2 s  . co  m*/

        if (getCellStyleGenerator() != null) {
            String cellStyle = getCellStyleGenerator().getStyle(this, null, columnId);
            if (cellStyle != null && !cellStyle.equals("")) {
                target.addAttribute("style-" + _columnIdMap().key(columnId), cellStyle + "-ag");
            }
        }

        String value = (String) aggregations.get(columnId);
        target.addText(value);
    }
    target.endTag("arow");
}

From source file:org.vaadin.tltv.multiscrolltable.ui.CustomScrollTable.java

License:Apache License

private void paintRows(PaintTarget target, Object[][] cells, int cols) throws PaintException {
    int index = 0;
    // Add rows and cell values to the UIDL
    if (cells != null && cols > 0) {
        target.startTag(TAG_ROWS);/*from   ww  w . j  a  v  a 2s. c o  m*/
        if (rowStructureChanged) {
            target.addAttribute(ATTR_ROW_STRUCTURE_CHANGED, true);
        } else if (rowsChanged) {
            target.addAttribute(ATTR_ROWS_CHANGED, true);
        }

        int size = size();
        int end = cells[0].length;
        if (end > size) {
            end = size;
        }
        String v;
        for (int i = 0; i < end; i++) {
            index = (Integer) cells[0][i];

            target.startTag(TAG_TR);
            target.addAttribute(ATTR_INDEX, index);
            Object itemId = ((Indexed) datasource).getIdByIndex(index);

            String rowHeader = getRowHeaderByIndex(index);
            if (rowHeader != null) {
                target.addAttribute(ATTR_CAPTION, rowHeader);
            }
            String rowDescription = getRowDescriptionByIndex(index);
            if (rowDescription != null && rowDescription.length() > 0) {
                target.addAttribute(ATTR_DESCRIPTION, rowDescription);
            }

            target.addAttribute(ATTR_DEPTH,
                    getContainerStrategy().getDepth(((Indexed) datasource).getIdByIndex(index)));

            if (getContainerDataSource().areChildrenAllowed(itemId)) {
                target.addAttribute(ATTR_CHILDRENS_ALLOWED, true);
                target.addAttribute(ATTR_OPEN, getContainerStrategy().isNodeOpen(itemId));
            }

            for (int j = 1; j < (cols + 1); j++) {
                v = (String) cells[j][i];
                if (v == null) {
                    v = "";
                }
                target.startTag(TAG_VALUE);
                target.addText(v);
                target.endTag(TAG_VALUE);
            }

            target.endTag(TAG_TR);
        }
        target.endTag(TAG_ROWS);
    }
    rowStructureChanged = false;
    rowsChanged = false;
}