/*
 * HtmlPropertyEditor.java
 *
 * Created on October 18, 2000, 2:46 PM
 */

package ovt.servlet;

import ovt.beans.*;

import java.io.*;

/**
 *
 * @author  ko
 * @version 
 */
public abstract class HtmlPropertyEditor extends Object {
    
    protected BasicPropertyEditor ed = null;
    protected BasicPropertyDescriptor desc = null;
    /** Holds value of property ownerForm. */
    protected HtmlForm form = null;
    protected String ame = "";
    
    /** Holds value of property name. */
    protected String name;
    
    /** Creates new HtmlPropertyEditor */
    public HtmlPropertyEditor(String name) {
        this.name = name;
    }
    
    /** Creates new HtmlPropertyEditor */
    public HtmlPropertyEditor(BasicPropertyDescriptor desc) {
        this.desc = desc;
        this.ed = desc.getPropertyEditor();
        this.name = desc.getPropertyPathString();
    }
    
    protected BasicPropertyDescriptor getDesc() {
        return desc;
    }
    
    protected BasicPropertyEditor getEd() {
        return ed;
    }
    
    public String getPropertyDisplayName() {
        if (desc != null) return desc.getDisplayName();
        else return "no display name";
    }
    
    public void onChangeSubmit(HtmlForm form) {
        this.form = form;
    }
    
    public HtmlForm getForm() {
        return form;
    }
    
    public boolean submitOnChange() {
        return (form != null);
    }
    /** Getter for property name.
     * @return Value of property name.
     */
    public String getName() {
        return name;
    }
    
}