Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 // Copyright 2007, 2008 The Apache Software Foundation
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.tapestry5.corelib.components;
A component for formatting output. If the component is represented in the template using an element, then the element (plus any informal parameters) will be output around the formatted value.
public class Output
The value to be output (before formatting). If the formatted value is blank, no output is produced.
    @Parameter(required = true, autoconnect = true)
    private Object value;

The format to be applied to the object.
    @Parameter(required = true, allowNull = false)
    private Format format;

If true, the default, then output is filtered, escaping any reserved characters. If false, the output is written raw.
    private boolean filter = true;

The element name, derived from the component template. This can even be overridden manually if desired (for example, to sometimes render a surrounding element and other times not).
    private String elementName;
    private ComponentResources resources;
    boolean beginRender(MarkupWriter writer)
        if ( == nullreturn false;
        String formatted = .format();
        if (InternalUtils.isNonBlank(formatted))
            if ( != null)
            if (writer.write(formatted);
            else writer.writeRaw(formatted);
            if ( != nullwriter.end();
        return false;
    // For testing.
    void setup(Object valueFormat formatboolean filterString elementNameComponentResources resources)
        this. = value;
        this. = format;
        this. = filter;
        this. = elementName;
        this. = resources;
New to GrepCode? Check out our FAQ X