// generated by FBuilder
package flexa.ff;
import flexa.fb.*;
import java.util.Map;
import java.util.HashMap;
import javax.script.*;
import java.util.ArrayList;
public class card extends FComponent {
    //
    // CONSTRUCTOR
    //
    public card() {
        super("ff.card");
    }
    
    // 
    // Methods
    //
    
    
    public void updateFromRequest(HashMap<String, Object> aParameters)  throws Exception { 
    		if( aParameters.containsKey(this.getValue("name")) )
		        this.setValue("value", aParameters.get(this.getValue("name")).toString());
		super.updateFromRequest(aParameters);

    }
    


    // 
    // Events
    //
	public void event(String aAction, FContext aContext) throws Exception {
        // Events
        
    
        // onopen EVENT
        if( LibText.stringToArray("" + this.name + ".select," + this.name + ".refresh,onopen,start").contains(aAction) ) {
        			if( this.status <= 0  && hasValue("datasource") ) {
			    //Log.getInstance().info("card event " + aAction + " datasource : " + (String)getValue("datasource") );
			    // Execute ds
			    Log.info("[refresh] " + this.id + " " + (this.context != null ? "with context" : "without context"));
			    Log.info(aContext);
			    Log.info(this.context);
			    FResult result = this.processDatasource(aContext); //Util.sqltoarrayddtotal(aContext, (String)getValue("datasource"));
			    Log.info("[refresh]", result);
			    // Clone me
			    this.clonefromresult(result, aContext);
			}

        }
    


	    super.event(aAction, aContext);
	}
	
	
}