Examples of SimpleSequence


Examples of freemarker.template.SimpleSequence

        return "element";
    }
   
    public TemplateSequenceModel getChildNodes() {
        if (nestedElements != null) {
            return new SimpleSequence(nestedElements);
        }
        SimpleSequence result = new SimpleSequence();
        if (nestedBlock != null) {
            result.add(nestedBlock);
        }
        return result;
    }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        this.items = items;
        items.trimToSize();
    }

    TemplateModel _eval(Environment env) throws TemplateException {
        SimpleSequence list = new SimpleSequence(items.size());
        for (Iterator it = items.iterator(); it.hasNext();) {
            Expression exp = (Expression) it.next();
            TemplateModel tm = exp.eval(env);
            if (env == null || !env.isClassicCompatible()) {           
                exp.assertNonNull(tm, env);
            }
            list.add(tm);
        }
        return list;
    }
View Full Code Here

Examples of freemarker.template.SimpleSequence

   
    // A hacky routine used by VisitNode and RecurseNode
   
    TemplateSequenceModel evaluateStringsToNamespaces(Environment env) throws TemplateException {
        TemplateSequenceModel val = (TemplateSequenceModel) eval(env);
        SimpleSequence result = new SimpleSequence(val.size());
        for (int i=0; i<items.size(); i++) {
            Object itemExpr = items.get(i);
            if (itemExpr instanceof StringLiteral) {
                String s = ((StringLiteral) itemExpr).getAsString();
                try {
                    Environment.Namespace ns = env.importLib(s, null);
                    result.add(ns);
                }
                catch (IOException ioe) {
                    throw new _MiscTemplateException(((StringLiteral) itemExpr), new Object[] {
                            "Couldn't import library ", new _DelayedJQuote(s), ": ",
                            new _DelayedGetMessage(ioe) });
                }
            }
            else {
                result.add(val.get(i));
            }
        }
        return result;
    }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        protected Set keySet() {
            return ((Map) object).keySet();
        }

        public TemplateCollectionModel values() {
            return new CollectionAndSequence(new SimpleSequence(((Map) object).values(), wrapper));
        }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        protected Set keySet() {
            return ((Map) object).keySet();
        }

        public TemplateCollectionModel values() {
            return new CollectionAndSequence(new SimpleSequence(((Map) object).values(), wrapper));
        }
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

    public static class WordList extends StringFunctions {
        @Override
        public TemplateModel apply(String string, Environment env, BuiltInExpression caller) {
            StringTokenizer st = new StringTokenizer(string);
            SimpleSequence result = new SimpleSequence();
            while (st.hasMoreTokens()) {
                result.add(st.nextToken());
            }
            return result;
        }
View Full Code Here

Examples of freemarker.template.SimpleSequence

        return wrapper.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
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.