Search in sources :

Example 1 with CompoundRoot

use of com.opensymphony.xwork2.util.CompoundRoot in project onebusaway-application-modules by camsys.

the class MessageComponent method end.

@Override
public boolean end(Writer writer, String body) {
    if (_key != null) {
        ValueStack stack = getStack();
        CompoundRoot root = stack.getRoot();
        TextProvider textProvider = null;
        for (Object obj : root) {
            if (obj instanceof TextProvider) {
                textProvider = (TextProvider) obj;
                break;
            }
        }
        if (textProvider != null) {
            String message = textProvider.getText(_key, _arguments);
            if (message != null) {
                try {
                    writer.write(message);
                } catch (IOException e) {
                    LOG.error("Could not write out tag", e);
                }
            }
        }
    }
    return super.end(writer, "");
}
Also used : ValueStack(com.opensymphony.xwork2.util.ValueStack) CompoundRoot(com.opensymphony.xwork2.util.CompoundRoot) IOException(java.io.IOException) TextProvider(com.opensymphony.xwork2.TextProvider)

Aggregations

TextProvider (com.opensymphony.xwork2.TextProvider)1 CompoundRoot (com.opensymphony.xwork2.util.CompoundRoot)1 ValueStack (com.opensymphony.xwork2.util.ValueStack)1 IOException (java.io.IOException)1