Example usage for com.vaadin.server PaintTarget addAttribute

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

Introduction

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

Prototype

public void addAttribute(String string, Object[] keys);

Source Link

Usage

From source file:org.eclipse.hawkbit.ui.dd.criteria.ServerItemIdClientCriterion.java

License:Open Source License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    super.paintContent(target);
    int paintedComponents = 0;
    for (String cId : componentIds) {
        target.addAttribute(COMPONENT + paintedComponents, cId);
        paintedComponents++;//  ww w  . ja  va2 s.c  o m
    }
    target.addAttribute(COMPONENT_COUNT, paintedComponents);
    target.addAttribute(MODE, verificationMode.getShort());
}

From source file:org.eclipse.hawkbit.ui.dd.criteria.ServerViewClientCriterion.java

License:Open Source License

@Override
public void paintContent(final PaintTarget target) throws PaintException {
    int dropAreaStylesConfigCount = 0;
    for (final String dropAreaEntry : dropAreaHints) {
        target.addAttribute(DROP_AREA_CONFIG + dropAreaStylesConfigCount, dropAreaEntry);
        dropAreaStylesConfigCount++;// ww  w.ja v a2 s.  c om
    }
    target.addAttribute(DROP_AREA_CONFIG_COUNT, dropAreaStylesConfigCount);
    target.addAttribute(ERROR_MESSAGE, errorMessage);

    super.paintContent(target);
}

From source file:org.eclipse.hawkbit.ui.dd.criteria.ServerViewComponentClientCriterion.java

License:Open Source License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    super.paintContent(target);

    target.addAttribute(DRAG_SOURCE, dragSourceIdPrefix);

    int countDropTarget = 0;
    for (String prefix : validDropTargetIdPrefixes) {
        target.addAttribute(DROP_TARGET + countDropTarget, prefix);
        countDropTarget++;/*  w w  w  .ja  v  a 2 s . c  o  m*/
    }
    target.addAttribute(DROP_TARGET_COUNT, countDropTarget);

    int countDropAreas = 0;
    for (String dropArea : validDropAreaIds) {
        target.addAttribute(DROP_AREA + countDropAreas, dropArea);
        countDropAreas++;
    }
    target.addAttribute(DROP_AREA_COUNT, countDropAreas);
}

From source file:org.semanticsoft.vaaclipse.widgets.ExtendedVerticalLayout.java

License:Open Source License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    target.addAttribute(VExtendedVerticalLayout.VARIABLES, variables);
}

From source file:org.semanticsoft.vaaclipse.widgets.StackWidget.java

License:Open Source License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    super.paintContent(target);

    target.addAttribute("vaadock_tabsheet_state", state);
    target.addAttribute("maximize_enabled", this.maximizeEnabled);
    target.addAttribute("minimize_enabled", this.minimizeEnabled);
    target.addAttribute("svoi", 5);
}

From source file:org.vaadin.alump.ckeditor.AbstractCKEditorTextField.java

License:Apache License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    //super.paintContent(target);

    if (textIsDirty) {
        Object currValueObject = getValue();
        String currValue = currValueObject == null ? "" : currValueObject.toString();
        target.addVariable(this, VCKEditorTextField.VAR_TEXT, currValue);
        textIsDirty = false;// w ww  .java  2 s .c  o  m
    }

    target.addAttribute(VCKEditorTextField.ATTR_IMMEDIATE, isImmediate());
    target.addAttribute(VCKEditorTextField.ATTR_READONLY, isReadOnly());
    target.addAttribute(VCKEditorTextField.ATTR_VIEW_WITHOUT_EDITOR, isViewWithoutEditor());

    if (config != null) {
        target.addAttribute(VCKEditorTextField.ATTR_INPAGECONFIG, config.getInPageConfig());

        if (config.hasWriterRules()) {
            int i = 0;
            Set<String> tagNameSet = config.getWriterRulesTagNames();
            for (String tagName : tagNameSet) {
                target.addAttribute(VCKEditorTextField.ATTR_WRITERRULES_TAGNAME + i, tagName);
                target.addAttribute(VCKEditorTextField.ATTR_WRITERRULES_JSRULE + i,
                        config.getWriterRuleByTagName(tagName));
                ++i;
            }
        }

        if (config.hasWriterIndentationChars()) {
            target.addAttribute(VCKEditorTextField.ATTR_WRITER_INDENTATIONCHARS,
                    config.getWriterIndentationChars());
        }

        if (config.hasKeystrokeMappings()) {
            int i = 0;
            Set<Integer> keystrokeSet = config.getKeystrokes();
            for (Integer keystroke : keystrokeSet) {
                target.addAttribute(VCKEditorTextField.ATTR_KEYSTROKES_KEYSTROKE + i, keystroke);
                target.addAttribute(VCKEditorTextField.ATTR_KEYSTROKES_COMMAND + i,
                        config.getKeystrokeCommandByKeystroke(keystroke));
                ++i;
            }
        }

        if (config.hasProtectedSource()) {
            int i = 0;
            for (String protectedSourceRegex : config.getProtectedSource()) {
                target.addAttribute(VCKEditorTextField.ATTR_PROTECTED_SOURCE + i, protectedSourceRegex);
                ++i;
            }
        }
    }

    target.addAttribute(VCKEditorTextField.ATTR_PROTECTED_BODY, protectedBody);

    if (insertHtml != null) {
        target.addAttribute(VCKEditorTextField.ATTR_INSERT_HTML, insertHtml);
        insertHtml = null;
    }
    if (insertText != null) {
        target.addAttribute(VCKEditorTextField.ATTR_INSERT_TEXT, insertText);
        insertText = null;
    }

    if (focusRequested) {
        target.addAttribute(VCKEditorTextField.ATTR_FOCUS, true);
        focusRequested = false;
    }

}

From source file:org.vaadin.openesignforms.ckeditor.CKEditorTextField.java

License:Open Source License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    //super.paintContent(target);

    if (textIsDirty) {
        Object currValueObject = getValue();
        String currValue = currValueObject == null ? "" : currValueObject.toString();
        target.addVariable(this, VCKEditorTextField.VAR_TEXT, currValue);
        textIsDirty = false;/*w ww .  jav a  2 s. c  om*/
    }

    target.addAttribute(VCKEditorTextField.ATTR_READONLY, isReadOnly());
    target.addAttribute(VCKEditorTextField.ATTR_VIEW_WITHOUT_EDITOR, isViewWithoutEditor());
    //System.out.println("*** TRACE FROM SERVER paintContent() - sending value to browser (" + currValue.length() + ") >>>" + currValue + "<<< " + System.currentTimeMillis());

    if (config != null) {
        target.addAttribute(VCKEditorTextField.ATTR_INPAGECONFIG, config.getInPageConfig());

        if (config.hasWriterRules()) {
            int i = 0;
            Set<String> tagNameSet = config.getWriterRulesTagNames();
            for (String tagName : tagNameSet) {
                target.addAttribute(VCKEditorTextField.ATTR_WRITERRULES_TAGNAME + i, tagName);
                target.addAttribute(VCKEditorTextField.ATTR_WRITERRULES_JSRULE + i,
                        config.getWriterRuleByTagName(tagName));
                ++i;
            }
        }

        if (config.hasWriterIndentationChars()) {
            target.addAttribute(VCKEditorTextField.ATTR_WRITER_INDENTATIONCHARS,
                    config.getWriterIndentationChars());
        }

        if (config.hasKeystrokeMappings()) {
            int i = 0;
            Set<Integer> keystrokeSet = config.getKeystrokes();
            for (Integer keystroke : keystrokeSet) {
                target.addAttribute(VCKEditorTextField.ATTR_KEYSTROKES_KEYSTROKE + i, keystroke);
                target.addAttribute(VCKEditorTextField.ATTR_KEYSTROKES_COMMAND + i,
                        config.getKeystrokeCommandByKeystroke(keystroke));
                ++i;
            }
        }

        if (config.hasProtectedSource()) {
            int i = 0;
            for (String protectedSourceRegex : config.getProtectedSource()) {
                target.addAttribute(VCKEditorTextField.ATTR_PROTECTED_SOURCE + i, protectedSourceRegex);
                ++i;
            }
        }
    }

    target.addAttribute(VCKEditorTextField.ATTR_PROTECTED_BODY, protectedBody);

    if (insertHtml != null) {
        target.addAttribute(VCKEditorTextField.ATTR_INSERT_HTML, insertHtml);
        insertHtml = null;
    }
    if (insertText != null) {
        target.addAttribute(VCKEditorTextField.ATTR_INSERT_TEXT, insertText);
        insertText = null;
    }

    if (focusRequested) {
        target.addAttribute(VCKEditorTextField.ATTR_FOCUS, true);
        focusRequested = false;
    }

}

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

License:Apache License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    final Object[] colids = getVisibleColumns();
    final Object[][] cells = getVisibleCells();
    final int cols = colids.length;

    target.addAttribute(ATTR_IMMEDIATE, isImmediate());
    target.addAttribute(ATTR_COLS, cols);
    target.addAttribute(ATTR_ROWS, requestedRowsToPaint);
    target.addAttribute(ATTR_TOTALROWS, size());
    target.addAttribute(ATTR_REQFIRSTROW, requestedFirstRowToPaint);
    target.addAttribute(ATTR_REQFIRSTCOL, requestedFirstColToPaint);
    target.addAttribute(ATTR_BUFFERSIZE, ROW_BUFFER_SIZE);
    target.addAttribute(ATTR_SCROLL_GROUPS, scrollContents.size());

    boolean doPaintRows = !measureSpaceForRowsAvailable;
    if (measureSpaceForRowsAvailable) {
        target.addAttribute(ATTR_CHECK_SPACE_AVAILABLE, true);
        measureSpaceForRowsAvailable = false;
    }//  w  ww. j  a va2s. co m

    paintColumns(target);
    paintFloatingRows(target);
    if (doPaintRows) {
        paintRows(target, cells, cols);
    }

}

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

License:Apache License

private void paintColumns(PaintTarget target) throws PaintException {
    target.startTag(TAG_COLUMNS);/*from  w  ww .  j a va 2s .co m*/
    if (columnStructureChanged) {
        target.addAttribute(ATTR_COLUMN_STRUCTURE_CHANGED, true);
    }
    int index = 0;

    // Paint all scroll contents
    for (ScrollContent sc : scrollContents) {
        target.startTag(TAG_SCROLLCONTENT);

        // Paint scroll content's column groups
        for (ColumnGroup cg : sc.getColumnGroups()) {
            index = paintColumnGroup(target, cg, index);
        }
        target.endTag(TAG_SCROLLCONTENT);
    }
    target.endTag(TAG_COLUMNS);
    columnStructureChanged = false;
}

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

License:Apache License

private int paintColumnGroup(PaintTarget target, ColumnGroup cg, int index) throws PaintException {
    target.startTag(TAG_COLUMNGROUP);/*from  w w  w . jav  a  2  s  .com*/
    target.addAttribute(ATTR_CAPTION, defaultString(cg.getCaption()));

    if (cg instanceof HierarchicalColumnGroup) {
        // Paint column group's hierarchical structure
        for (ColumnGroup subCg : ((HierarchicalColumnGroup) cg).getSubColumnGroups()) {
            index = paintColumnGroup(target, subCg, index);
        }
    } else {
        // Paint column group's columns
        for (Column c : cg.getColumns()) {
            paintColumn(target, c, index++);
        }
    }
    target.endTag(TAG_COLUMNGROUP);

    return index;
}