package flexa.ff;
import flexa.fb.*;
import java.util.Map;
import java.util.HashMap;
import javax.script.*;
public class input extends FComponent {
    //
    // CONSTRUCTOR
    //
    public input() {
        super("ff.input");
    }
    
    // 
    // Methods
    //
    
    
    public void updateFromRequest(HashMap<String, Object> aParameters)  { 
    		String tName = (String)this.getValue("id");
		String tType = (String)this.getValue("type");
		if( aParameters.containsKey(tName) ) {
		    String tVal = (String)aParameters.get(this.getValue("id"));
		    Log.getInstance().info("updateFromRequest " + tName + " type " + tType + " = " + tVal);
			switch(tType) {
			    case "integer":
			        this.setValue("value", (tVal == null || tVal.trim().equals("")) ? 0 : Integer.parseInt(tVal));
			        break;
			    case "decimal":
			    case "money":
			    case "date":
			    case "datetime":
			    case "timestamp":
			    case "time":
			    case "text":
			    case "password":
			    case "email":
			    case "url":
			    case "tel":
			    case "checkbox":
		        default:
		            this.setValue("value", tVal);
			}
		}

    }
    


    // 
    // Events
    //
	public void event(String aAction, FContext aContext) throws Exception {
        
	    super.event(aAction, aContext);
	}
	
	
	
	
}