package org.opengroupware.jope.appserver.elements;

import org.opengroupware.jope.appserver.WOContext;
import org.opengroupware.jope.appserver.WOElement;
import org.opengroupware.jope.appserver.WOResponse;

public class WOStaticHTMLElement extends WOElement {
  
  protected String string;

  public WOStaticHTMLElement(String _s) {
    this.string = _s;
  }
  
  /* responder */

  public void appendToResponse(WOResponse _r, WOContext _ctx) {
    if (this.string != null)
      _r.appendContentString(this.string);
  }
  
  /* description */
  
  public void appendAttributesToDescription(StringBuffer _d) {
    super.appendAttributesToDescription(_d);
    
    if (this.string == null)
      _d.append(" no-string");
    else {
      _d.append(" \"");
      if (this.string.length() > 80) {
        _d.append(this.string.substring(0, 76));
        _d.append("...");
      }
      else
        _d.append(this.string);
      _d.append('"');
    }
  }
}
