package mildo.wiwo.components;

import mildo.wiwo.Session;
import mildo.wiwo.action.EditAction;
import mildo.wiwo.components.descriptors.IActionDescriptor;
import mildo.wiwo.components.descriptors.ObjectListTableDescriptor;
import mildo.wiwo.data.WiwoNameSpace;

import com.webobjects.appserver.WOContext;
import com.webobjects.foundation.NSArray;

// Generated by the WOLips Templateengine Plug-in at Apr 19, 2009 11:41:57 AM
public class NameSpaceListTableComp 
	extends mildo.wiwo.components.BaseComp 
{

	public NameSpaceListTableComp(WOContext context) {
        super(context);
    }
	
	public NSArray getNameSpaces() {
		//return WiwoNameSpace.fetchRequiredWiwoNameSpace(session().defaultEditingContext(), PersistHelper.makeEqQualifier("administrators", ((Session)session()).getActualSessionUser()));
		return WiwoNameSpace.fetchAllWiwoNameSpaces(session().defaultEditingContext());
	}
	
	private ObjectListTableDescriptor tableDescriptor;
	
	public void setTableDescriptor(ObjectListTableDescriptor aValue) {
		tableDescriptor = aValue;
	}
	
	public ObjectListTableDescriptor getTableDescriptor() {
		Session theSession = (Session) session(); 
		EditAction theAction = new EditAction(theSession, this);
		if (tableDescriptor == null) {
			tableDescriptor = new ObjectListTableDescriptor(TABLE_ATTRIBUTES_STRINGS, TABLE_HEADER_STRINGS, 
					new IActionDescriptor[]{theAction, theAction});
		}
		return tableDescriptor;
	}
	
	public static final String[] TABLE_HEADER_STRINGS = {"Name", "Description"};
	public static final String[] TABLE_ATTRIBUTES_STRINGS = {"name", "description"};
	
}