// 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 gallery extends FField {
    //
    // CONSTRUCTOR
    //
    public gallery() {
        super("ff.gallery");
    }
    
    // 
    // Methods
    //
    
    
    public void updateFromObject(FObjectInterface aObject)  throws Exception { 
    		String tName = (String)this.getValue("name");
		Log.getInstance().info("updateFromObject gallery " + tName);
		if( tName != null && !tName.equals("") ) {
			//this.fobject = aObject;
			if( aObject.hasMember(tName) ) {
			    //if( this.getValue("src") == null || this.getValue("src").toString().equals("") ) 
				super.setValue("value", aObject.getMember(tName));
			}
		}

    }
    





    // 
    // Events
    //
	public void event(String aAction, FContext aContext) throws Exception {
        // Events
        
    
        // onopenjava EVENT
        if( LibText.stringToArray("" + this.name + ".refresh,onopen,start").contains(aAction) ) {
        			String ttype = (String)this.getValue("type");
			if( ttype == null || !type.equals("readonly") ) {
			    if( !this.hasValue("uploadsubdir") ) {
			        this.setValue("uploadsubdir", LibDate.getYear(LibDate.today()) + "_" + LibDate.getMonth(LibDate.today()) + "/" + LibText.randomtext(10) + "/");
			        Log.info(this.id + " uploadsubdir random: ", this.getValue("uploadsubdir"));
			    }
			}

        }
    


	    super.event(aAction, aContext);
	}
	
	
}