1 5 package org.exoplatform.text.template.xhtml; 6 7 import java.io.IOException ; 8 import java.io.Writer ; 9 import java.util.ResourceBundle ; 10 import org.exoplatform.commons.utils.ExpressionUtil; 11 import org.exoplatform.text.template.*; 12 13 18 public class Text extends Element { 19 protected Value data_ ; 20 21 public Text(String value) { 22 if(value == null ) return ; 23 if(ExpressionUtil.isResourceBindingExpression(value)) { 24 data_ = new ResourceBindingValue(value) ; 25 } else if(ExpressionUtil.isDataBindingExpression(value)) { 26 data_ = new DataBindingValue(value) ; 27 } else { 28 data_ = new StringValue(value) ; 29 } 30 } 31 32 public Value getData() { return data_ ; } 33 34 35 public void render(XhtmlDataHandlerManager manager, 36 ResourceBundle res, Writer w) throws IOException { 37 DataHandler dh = manager.getDataHandler(dataHandlerType_) ; 38 w.write(resolveValueAsString(data_ ,dh, res)) ; 39 } 40 } | Popular Tags |