package mildo.wiwo.components;

import mildo.wiwo.Session;
import mildo.wiwo.components.descriptors.ObjectListTableDescriptor;

import com.webobjects.appserver.*;
import com.webobjects.eocontrol.EOEnterpriseObject;
import com.webobjects.foundation.NSArray;

// Generated by the WOLips Templateengine Plug-in at Apr 19, 2009 9:01:16 AM
public class ObjectListTableComp 
	extends mildo.wiwo.components.BaseComp 
{
    
	public ObjectListTableComp(WOContext context) {
        super(context);
    }
	
	private NSArray objectList;
	
	public void setObjectList(NSArray aValue) {
		objectList = aValue;
	}
	
	public NSArray getObjectList() {
		return objectList;
	}
	
	// -------------
	
	private EOEnterpriseObject currentObject;
	
	public void setCurrentObject(EOEnterpriseObject anObject) {
		currentObject = anObject;
	}
	
	public EOEnterpriseObject getCurrentObject() {
		return currentObject;
	}
	
	// --------------
	
	private ObjectListTableDescriptor tableDescriptor;
	
	public void setTableDescriptor(ObjectListTableDescriptor aValue) {
		tableDescriptor = aValue;
	}
	
	public ObjectListTableDescriptor getTableDescriptor() {
		return tableDescriptor;
	}
	
	// ---------------
	
	public Object getAttribute() {
		return getCurrentObject().valueForKey(tableDescriptor.getAttribute2Display());
	}
	
	public WOComponent performAction() {
		tableDescriptor.getCurrentAction().setObject(currentObject);
		tableDescriptor.getCurrentAction().setComponent(this);
		tableDescriptor.getCurrentAction().setSession((Session)session());
		return tableDescriptor.getCurrentAction().performAction();
	}
	
}