Examples of SimpleSequence


Examples of freemarker.template.SimpleSequence

   */
  public TemplateModel wrap(Object obj) throws TemplateModelException {
    if (obj == null) { return super.wrap(null); }
    if (obj instanceof List<?>) { return new CollectionModel((Collection<?>) obj, this); }
    // 使得set等集合可以排序
    if (obj instanceof Collection<?>) { return new SimpleSequence((Collection<?>) obj, this); }
    if (obj instanceof Map<?, ?>) {
      if (altMapWrapper) {
        return new FriendlyMapModel((Map<?, ?>) obj, this);
      } else {
        return new MapModel((Map<?, ?>) obj, this);
View Full Code Here

Examples of freemarker.template.SimpleSequence

      return ((Map<?, ?>) object).keySet();
    }

    // add feature
    public TemplateCollectionModel values() {
      return new CollectionAndSequence(new SimpleSequence(((Map<?, ?>) object).values(),
          wrapper));
    }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        if (Debug.infoOn()) Debug.logInfo("Retreiving HTTP resource at: " + page, module);
        try {
            String result = null;
           
            List entityList = (List)request.getAttribute("entityList");
            SimpleSequence simpleList = new SimpleSequence(entityList);
            Map ctx = new HashMap();
            ctx.put("entityList", simpleList);
            StringWriter outWriter = new StringWriter();
            Template template = getDocTemplate(page);
            template.process(ctx, outWriter);
View Full Code Here

Examples of freemarker.template.SimpleSequence

    public int size() {
        return map.size();
    }

    public TemplateCollectionModel keys() {
        return new CollectionAndSequence(new SimpleSequence(map.keySet(), getObjectWrapper()));
    }
View Full Code Here

Examples of freemarker.template.SimpleSequence

    public TemplateCollectionModel keys() {
        return new CollectionAndSequence(new SimpleSequence(map.keySet(), getObjectWrapper()));
    }

    public TemplateCollectionModel values() {
        return new CollectionAndSequence(new SimpleSequence(map.values(), getObjectWrapper()));
    }
View Full Code Here

Examples of freemarker.template.SimpleSequence

   
    void visit(TemplateNodeModel node, TemplateSequenceModel namespaces)
    throws TemplateException, IOException
    {
        if (nodeNamespaces == null) {
            SimpleSequence ss = new SimpleSequence(1);
            ss.add(currentNamespace);
            nodeNamespaces = ss;
        }
        int prevNodeNamespaceIndex = this.nodeNamespaceIndex;
        String prevNodeName = this.currentNodeName;
        String prevNodeNS = this.currentNodeNS;
View Full Code Here

Examples of freemarker.template.SimpleSequence

                    }
                }
            }
            else if (positionalArgs != null) {
                if (catchAll != null)
                    unknownVars = new SimpleSequence();
                String[] argumentNames = macro.getArgumentNamesInternal();
                int size = positionalArgs.size();
                if (argumentNames.length < size && catchAll == null) {
                    throw new _MiscTemplateException(this, new Object[] {
                            "Macro " + StringUtil.jQuote(macro.getName()) + " only accepts "
View Full Code Here

Examples of freemarker.template.SimpleSequence

        return wrapper.getClassIntrospector().keyCount(object.getClass());
    }

    public TemplateCollectionModel keys()
    {
        return new CollectionAndSequence(new SimpleSequence(keySet(), wrapper));
    }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        TemplateModelIterator it = keys().iterator();
        while (it.hasNext()) {
            String key = ((TemplateScalarModel)it.next()).getAsString();
            values.add(get(key));
        }
        return new CollectionAndSequence(new SimpleSequence(values, wrapper));
    }
View Full Code Here

Examples of freemarker.template.SimpleSequence

            for (int i = 0; i < resultSize; i++) {
                list.add(targetSeq.get(srcIdx));
                srcIdx += step;
            }
            // List items are already wrapped, so the wrapper will be null:
            return new SimpleSequence(list, null);
        } else {
            final int exclEndIdx;
            if (step < 0 && resultSize > 1) {
                if (!(range.isAffactedByStringSlicingBug() && resultSize == 2)) {
                    throw new _MiscTemplateException(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.