package org.opengroupware.jope.jsapp;

import org.opengroupware.jope.appserver.core.WOContext;
import org.opengroupware.jope.ofs.OFSBaseObject;

public abstract class JSJoObject extends OFSBaseObject {
  
  protected WOContext context;

  public JSJoObject(Object _container, String _name, WOContext _ctx) {
    super();
    this.context = _ctx;
    this.setLocation(_container, _name);
  }

  /* IJoLocation interface */
  
  public Object container() {
    return this.container;
  }
  public String nameInContainer() {
    return this.nameInContainer;
  }

  /* description */

  @Override
  public void appendAttributesToDescription(StringBuilder _d) {
    super.appendAttributesToDescription(_d);
    
    _d.append(" name=" + this.nameInContainer);
    if (this.container != null) {
      _d.append(" container=");
      _d.append(this.container.getClass().getSimpleName());
    }
    
    _d.append(this.context != null ? " ctx" : " no-ctx");
  }
}
