Example usage for com.vaadin.server PaintTarget addVariable

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

Introduction

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

Prototype

public void addVariable(VariableOwner owner, String name, Component value) throws PaintException;

Source Link

Document

Adds a Component type variable.

Usage

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

License:Apache License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    // Post file to this stream variable
    target.addVariable(this, "uploadUrl", getStreamVariable());
}

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

License:Apache License

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

    if (hasGroups()) {
        final Collection groupProperties = getGroupProperties();
        final String[] groupColumns = new String[groupProperties.size()];

        int index = 0;
        for (final Object groupColumnId : groupProperties) {
            groupColumns[index++] = columnIdMap.key(groupColumnId);
        }//from  w ww . jav a 2 s .  c om
        target.addVariable(this, "groupColumns", groupColumns);
    }
}

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

License:Apache License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    target.addVariable(this, "action", getStreamVariable());
}

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

License:Apache License

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

    if (hasGroups()) {
        Collection groupProperties = getGroupProperties();
        String[] groupColumns = new String[groupProperties.size()];

        int index = 0;
        for (Object groupColumnId : groupProperties) {
            groupColumns[index++] = _columnIdMap().key(groupColumnId);
        }/*w  w w .  j  a v  a 2s . co  m*/
        target.addVariable(this, "groupColumns", groupColumns);
    }
}

From source file:com.wcs.wcslib.vaadin.widget.multifileupload.component.MultiUpload.java

License:Apache License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    target.addVariable(this, "target", streamVariable);
    target.addAttribute("maxFileSize", maxFileSize);
    target.addAttribute("sizeErrorMsg", sizeErrorMsg);
    target.addAttribute("acceptFilter", acceptFilter);
    if (acceptedMimeTypes != null) {
        target.addAttribute("acceptedMimeTypes",
                acceptedMimeTypes.toArray(new String[acceptedMimeTypes.size()]));
    } else {//from w  w  w  .ja v  a 2s . c  o m
        target.addAttribute("acceptedMimeTypes", new String[] {});
    }

    target.addAttribute("mimeTypeErrorMsg", mimeTypeErrorMsg);
    target.addAttribute("enabled", enabled);
    if (ready) {
        target.addAttribute("ready", true);
        ready = false;
    }
    target.addAttribute("buttoncaption", getButtonCaption());
    if (!interruptedFileIds.isEmpty()) {
        target.addAttribute("interruptedFileIds",
                interruptedFileIds.toArray(new Long[interruptedFileIds.size()]));
        interruptedFileIds = new ArrayList<>();
    }
}

From source file:dk.apaq.vaadin.addon.printservice.PrintServiceApplet.java

License:Open Source License

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

    // Applet class
    if (getAppletClass() == null) {
        // Do not paint anything of class is missing
        return;//w  ww .  j av  a  2s. c  o m
    }

    LOG.debug("Painting PrintApplet.");
    target.addAttribute(VAppletIntegration.ATTR_APPLET_NAME, "Printer");
    target.addVariable(this, VAppletIntegration.ATTR_APPLET_ACTION, "dummy");
}

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;/*  ww w .ja  v a  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 w  w  .  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;
    }

}