Package freemarker.template

Examples of freemarker.template.SimpleScalar


            public TemplateModel get(String key)
            throws
                TemplateModelException
            {
                return new SimpleScalar(env.formatDate(dateModel, key, target));
            }
View Full Code Here


                return get((String) args.get(0));
            }
   
            public TemplateModel get(String key)
            {
                return new SimpleScalar(env.getNumberFormatObject(key).format(number));
            }
View Full Code Here

        TemplateModel _eval(Environment env) throws TemplateException {
            TemplateModel model = target.eval(env);
            if (model instanceof TemplateNumberModel) {
                return formatNumber(env, model);
            } else if (model instanceof TemplateBooleanModel) {
                return new SimpleScalar(((TemplateBooleanModel) model).getAsBoolean()
                        ? MiscUtil.C_TRUE : MiscUtil.C_FALSE);
            } else {
                throw new UnexpectedTypeException(
                        target, model,
                        "number or boolean", new Class[] { TemplateNumberModel.class, TemplateBooleanModel.class },
View Full Code Here

        while( iList.hasNext() ) {
            aResults.append( (String)iList.next() );
            aResults.append( "<br />" );
        }

        return new SimpleScalar( aResults.toString() );
    }
View Full Code Here

        if( key.equals( "model2" )) {
            return m_cSubModel;
        } else if( key.equals( "modellist" )) {
            return m_cListModel;
        } else if( key.equals( "selftest" )) {
            return new SimpleScalar( "Selftest of a hash from MultiModel1" );
        } else if( key.equals( "one" )) {
            return m_cListHashModel1;
        } else if( key.equals( "two" )) {
            return m_cListHashModel2;
        } else if( key.equals( "size" )) {
            return new SimpleScalar( "Nasty!" );
        } else if( key.equals( "nesting1" )) {
            return m_cHashModel;
        } else {
            return null;
        }
View Full Code Here

     * @return the <tt>TemplateModel</tt> referred to by the key,
     * or null if not found.
     */
    public TemplateModel get(String key) {
        if( key.equals( "temp" )) {
            return new SimpleScalar( "Hello, world." );
        } else if( key.equals( "boolean" )) {
            return TemplateBooleanModel.FALSE;
        } else {
            return new SimpleScalar( "Just another key..." );
        }
    }
View Full Code Here

            if (key.equals("@@") || key.equals("@*")) {
                return new NodeListModel(node.getAttributes(), this);
            }
            if (key.equals("@@start_tag")) {
                NodeOutputter nodeOutputter = new NodeOutputter(node);
                return new SimpleScalar(nodeOutputter.getOpeningTag((Element) node));
            }
            if (key.equals("@@end_tag")) {
                NodeOutputter nodeOutputter = new NodeOutputter(node);
                return new SimpleScalar(nodeOutputter.getClosingTag((Element) node));
            }
            if (key.equals("@@attributes_markup")) {
                StringBuffer buf = new StringBuffer();
                NodeOutputter nu = new NodeOutputter(node);
                nu.outputContent(node.getAttributes(), buf);
                return new SimpleScalar(buf.toString().trim());
            }
            if (StringUtil.isXMLID(key.substring(1))) {
                Attr att = getAttribute(key.substring(1));
                if (att == null) {
                    return new NodeListModel(this);
View Full Code Here

            for (int i=0; i<size(); i++) {
                NodeModel nm = (NodeModel) get(i);
                TemplateScalarModel textModel = (TemplateScalarModel) nm.get(key);
                result.append(textModel.getAsString());
            }
            return new SimpleScalar(result.toString());
        }
        if (StringUtil.isXMLID(key)
            || ((key.startsWith("@") && StringUtil.isXMLID(key.substring(1))))
            || key.equals("*") || key.equals("**") || key.equals("@@") || key.equals("@*"))
        {
View Full Code Here

     * @return the <tt>TemplateModel</tt> referred to by the key,
     * or null if not found.
     */
    public TemplateModel get(String key) {
        if( key.equals( "size" )) {
            return new SimpleScalar( "Key size, not the listSize method." );
        } else {
            return null;
        }
    }
View Full Code Here

    private LegacyList  m_cList = new LegacyList();

    /** Creates new MultiModel5 */
    public MultiModel5() {
        m_cList.add( new SimpleScalar( "Dummy to make list non-empty" ));
    }
View Full Code Here

TOP

Related Classes of freemarker.template.SimpleScalar

Copyright © 2018 www.massapicom. 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.