Java 类com.vaadin.server.PaintTarget 实例源码

项目:cuba    文件:CubaTreeTable.java   
@Override
protected void paintAdditionalData(PaintTarget target) throws PaintException {
    if (reqFirstRowToPaint == -1 && items instanceof AggregationContainer && isAggregatable()
            && !((AggregationContainer) items).getAggregationPropertyIds().isEmpty() && isShowTotalAggregation()
            && Table.AggregationStyle.TOP.equals(getAggregationStyle())) {
        paintAggregationRow(target, ((AggregationContainer) items).aggregate(new Context(items.getItemIds())));
    }

    // paint cuba-ids

    AppUI current = AppUI.getCurrent();
    if (current != null && current.isTestMode()) {
        ArrayList<String> visibleColOrder = new ArrayList<>();
        for (Object columnId : visibleColumns) {
            if (!isColumnCollapsed(columnId)) {
                visibleColOrder.add(columnId.toString());
            }
        }
        target.addAttribute("colcubaids", visibleColOrder.toArray());
    }
}
项目:cuba    文件:CubaTreeTable.java   
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;
        }

        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");
}
项目:cuba    文件:CubaTable.java   
@Override
protected void paintAdditionalData(PaintTarget target) throws PaintException {
    if (reqFirstRowToPaint == -1) {
        boolean hasAggregation = items instanceof AggregationContainer && isAggregatable()
                && !((AggregationContainer) items).getAggregationPropertyIds().isEmpty();

        if (hasAggregation && isShowTotalAggregation()
                && Table.AggregationStyle.TOP.equals(getAggregationStyle())) {
            Context context = new Context(getAggregationItemIds());
            paintAggregationRow(target, ((AggregationContainer) items).aggregate(context));
        }
    }

    // paint cuba-ids

    AppUI current = AppUI.getCurrent();
    if (current != null && current.isTestMode()) {
        ArrayList<String> visibleColOrder = new ArrayList<>();
        for (Object columnId : visibleColumns) {
            if (!isColumnCollapsed(columnId)) {
                visibleColOrder.add(columnId.toString());
            }
        }
        target.addAttribute("colcubaids", visibleColOrder.toArray());
    }
}
项目:cuba    文件:CubaTable.java   
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;
        }

        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");
}
项目:cuba    文件:CubaGroupTable.java   
@Override
protected void paintRowAttributes(PaintTarget target, Object itemId) throws PaintException {
    super.paintRowAttributes(target, itemId);

    boolean hasAggregation = items instanceof AggregationContainer && isAggregatable()
            && !((AggregationContainer) items).getAggregationPropertyIds().isEmpty();

    boolean hasGroups = hasGroups();
    if (hasGroups) {
        if (isGroup(itemId)) {
            target.addAttribute("colKey", columnIdMap.key(getGroupProperty(itemId)));
            target.addAttribute("groupKey", groupIdMap.key(itemId));
            if (isExpanded(itemId))
                target.addAttribute("expanded", true);

            final Object propertyValue = getGroupPropertyValue(itemId);
            target.addAttribute("groupCaption", formatGroupPropertyValue(itemId, propertyValue));

            if (hasAggregation) {
                paintGroupAggregation(target, itemId,
                        ((AggregationContainer) items).aggregate(new GroupAggregationContext(this, itemId)));
            }
        }
    }
}
项目:cuba    文件:CubaMenuBar.java   
@Override
protected void paintAdditionalItemParams(PaintTarget target, MenuItem item) throws PaintException {
    if (shortcuts != null && shortcuts.containsKey(item)) {
        String shortcut = shortcuts.get(item);
        if (shortcut != null) {
            target.addAttribute("shortcut", shortcut);
        }
    }
    if (testIds != null && testIds.containsKey(item)) {
        String testIdValue = testIds.get(item);
        if (testIdValue != null) {
            target.addAttribute("tid", testIdValue);
        }
    }
    if (cubaIds != null && cubaIds.containsKey(item)) {
        String idValue = cubaIds.get(item);
        if (idValue != null) {
            target.addAttribute("cid", idValue);
        }
    }
}
项目:hawkbit    文件:ServerViewComponentClientCriterion.java   
@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++;
    }
    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);
}
项目:cuba    文件:CubaTreeTable.java   
@Override
protected void paintActions(PaintTarget target, Set<Action> actionSet) throws PaintException {
    super.paintActions(target, actionSet);

    if (shortcutActionManager != null) {
        shortcutActionManager.paintActions(null, target);
    }
}
项目:cuba    文件:CubaTreeTable.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    if (beforePaintListener != null) {
        beforePaintListener.run();
    }

    super.paintContent(target);
}
项目:cuba    文件:CubaDateField.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    super.paintContent(target);

    if (shortcutsManager != null) {
        shortcutsManager.paintActions(null, target);
    }
}
项目:cuba    文件:CubaTable.java   
@Override
protected void paintActions(PaintTarget target, Set<Action> actionSet) throws PaintException {
    super.paintActions(target, actionSet);

    if (shortcutActionManager != null) {
        shortcutActionManager.paintActions(null, target);
    }
}
项目:cuba    文件:CubaTable.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    if (beforePaintListener != null) {
        beforePaintListener.run();
    }

    super.paintContent(target);
}
项目:cuba    文件:CubaGroupTable.java   
@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);
        }
        target.addVariable(this, "groupColumns", groupColumns);
    }
}
项目:cuba    文件:CubaGroupTable.java   
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;
        }

        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("");
        }
    }
}
项目:cuba    文件:CubaTree.java   
@Override
protected void paintActions(PaintTarget target, Set<Action> actionSet) throws PaintException {
    super.paintActions(target, actionSet);

    if (shortcutActionManager != null) {
        shortcutActionManager.paintActions(null, target);
    }
}
项目:cuba    文件:CubaTree.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    if (beforePaintListener != null) {
        beforePaintListener.run();
    }

    if (isNodeCaptionsAsHtml()) {
        target.addAttribute("nodeCaptionsAsHtml", true);
    }
    super.paintContent(target);
}
项目:cuba    文件:CubaWidgetsTree.java   
@Override
protected void paintItem(
        PaintTarget target,
        Object itemId,
        LinkedList<String> selectedKeys,
        LinkedList<String> expandedKeys
) throws PaintException {
    super.paintItem(target, itemId, selectedKeys, expandedKeys);

    if (itemIds.indexOf(itemId) >= 0) {
        target.addAttribute("widgetIndex", itemIds.indexOf(itemId));
    }
}
项目:cuba    文件:CubaTwinColSelect.java   
@Override
protected void paintItem(PaintTarget target, Object itemId)
        throws PaintException {
    super.paintItem(target, itemId);

    if (styleGenerator != null) {
        String style = styleGenerator.generateStyle(this, itemId, isSelected(itemId));
        if (!StringUtils.isEmpty(style)) {
            target.addAttribute("style", style);
        }
    }
}
项目:hawkbit    文件:ServerItemIdClientCriterion.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    super.paintContent(target);
    int paintedComponents = 0;
    for (String cId : componentIds) {
        target.addAttribute(COMPONENT + paintedComponents, cId);
        paintedComponents++;
    }
    target.addAttribute(COMPONENT_COUNT, paintedComponents);
    target.addAttribute(MODE, verificationMode.getShort());
}
项目:hawkbit    文件:ServerViewClientCriterion.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    int dropAreaStylesConfigCount = 0;
    for (String dropAreaEntry : dropAreaHints) {
        target.addAttribute(DROP_AREA_CONFIG + dropAreaStylesConfigCount, dropAreaEntry);
        dropAreaStylesConfigCount++;
    }
    target.addAttribute(DROP_AREA_CONFIG_COUNT, dropAreaStylesConfigCount);

    super.paintContent(target);
}
项目:context-menu    文件:MenuBar.java   
/** Paint (serialise) the component for the client. */
@Override
public void paintContent(PaintTarget target) throws PaintException {
    target.addAttribute(MenuBarConstants.OPEN_ROOT_MENU_ON_HOWER,
            openRootOnHover);

    if (isHtmlContentAllowed()) {
        target.addAttribute(MenuBarConstants.HTML_CONTENT_ALLOWED, true);
    }

    target.startTag("options");

    if (getWidth() > -1) {
        target.startTag("moreItem");
        target.addAttribute("text", moreItem.getText());
        if (moreItem.getIcon() != null) {
            target.addAttribute("icon", moreItem.getIcon());
        }
        target.endTag("moreItem");
    }

    target.endTag("options");
    target.startTag("items");

    // This generates the tree from the contents of the menu
    for (MenuItem item : getItems()) {
        paintItem(target, item);
    }

    target.endTag("items");
}
项目:vaadin-crichtextarea    文件:CRichTextArea.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
   if (selectAll) {
      target.addAttribute("selectAll", true);
      selectAll = false;
   }

   if (fontName != null) {
      target.addAttribute("fontName", fontName);
   }

   if (fontSize != 0) {
      target.addAttribute("fontSize", fontSize);
   }

   if (insertHtml != null) {
      target.addAttribute("insertHtml", insertHtml);
      insertHtml = null;
   }

   // Adds the content as variable
   String value = getValue();
   if (value == null) {
      value = getNullRepresentation();
   }
   if (value == null) {
      throw new IllegalStateException(
              "Null values are not allowed if the null-representation is null");
   }
   target.addVariable(this, "text", value);

}
项目:vaadin-asyncfiltercombobox    文件:AsyncFilterComboBox.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    target.addAttribute(AsyncFilterComboBoxConstants.ATTR_FILTERCHANGE_EVENTMODE,
                getFilterChangeEventMode().toString());
    target.addAttribute(AsyncFilterComboBoxConstants.ATTR_FILTERCHANGE_TIMEOUT,
            getFilterChangeTimeout());

    super.paintContent(target);
}
项目:cuba    文件:CubaOrderedActionsLayout.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    if (actionManager != null) {
        actionManager.paintActions(null, target);
    }
}
项目:cuba    文件:CubaCssActionsLayout.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    if (actionManager != null) {
        actionManager.paintActions(null, target);
    }
}
项目:cuba    文件:CubaGridLayout.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    if (actionManager != null) {
        actionManager.paintActions(null, target);
    }
}
项目:context-menu    文件:MenuBar.java   
private void paintItem(PaintTarget target, MenuItem item)
        throws PaintException {
    if (!item.isVisible()) {
        return;
    }

    target.startTag("item");

    target.addAttribute("id", item.getId());

    if (item.getStyleName() != null) {
        target.addAttribute(MenuBarConstants.ATTRIBUTE_ITEM_STYLE,
                item.getStyleName());
    }

    if (item.isSeparator()) {
        target.addAttribute("separator", true);
    } else {
        target.addAttribute("text", item.getText());

        Command command = item.getCommand();
        if (command != null) {
            target.addAttribute("command", true);
        }

        Resource icon = item.getIcon();
        if (icon != null) {
            target.addAttribute(MenuBarConstants.ATTRIBUTE_ITEM_ICON, icon);
        }

        if (!item.isEnabled()) {
            target.addAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DISABLED,
                    true);
        }

        String description = item.getDescription();
        if (description != null && description.length() > 0) {
            target.addAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION,
                    description);
        }
        if (item.isCheckable()) {
            // if the "checked" attribute is present (either true or false),
            // the item is checkable
            target.addAttribute(MenuBarConstants.ATTRIBUTE_CHECKED,
                    item.isChecked());
        }
        if (item.hasChildren()) {
            for (MenuItem child : item.getChildren()) {
                paintItem(target, child);
            }
        }

    }

    target.endTag("item");
}
项目:vaadin-diagram    文件:Diagram.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {
    if (getDropHandler() != null) {
        getDropHandler().getAcceptCriterion().paint(target);
    }
}
项目:AppletIntegration    文件:AppletIntegration.java   
@Override
public void paintContent(PaintTarget target) throws PaintException {

    // Applet class
    if (appletClass == null) {
        // Do not paint anything of class is missing
        return;
    }
    target.addAttribute(VAppletIntegration.ATTR_APPLET_CLASS, appletClass);

    // Applet HTTP Session id
    String sid = getHttpSessionId();
    if (sid != null) {
        target.addAttribute(VAppletIntegration.ATTR_APPLET_SESSION, sid);
    }

    // Applet archives
    if (appletArchives != null) {
        target.addAttribute(VAppletIntegration.ATTR_APPLET_ARCHIVES,
                appletArchives.toArray(new String[appletArchives.size()]));
    }

    // Applet codebase
    if (codebase != null) {
        target.addAttribute(VAppletIntegration.ATTR_APPLET_CODEBASE,
                codebase);
    }

    // Applet name
    if (name != null) {
        target.addAttribute(VAppletIntegration.ATTR_APPLET_NAME, name);
    }

    // Applet parameters
    if (appletParams != null) {
        target.addAttribute(VAppletIntegration.ATTR_APPLET_PARAM_NAMES,
                appletParams);
    }

    // Commands
    if (command != null) {
        target.addAttribute(VAppletIntegration.ATTR_CMD, command);
        command = null;
    }

    if (commandParams != null) {
        target.addAttribute(VAppletIntegration.ATTR_CMD_PARAMS,
                commandParams);
        commandParams = null;
    }
}