/*
 * This class was automatically generated with 
 * <a href="http://castor.exolab.org">Castor 0.9.2</a>, using an
 * XML Schema.
 * $Id$
 */

package org.apache.jetspeed.xml.api.portletmarkup;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.Enumeration;
import java.util.Vector;
import org.exolab.castor.xml.*;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.DocumentHandler;

/**
 * 
 * @version $Revision$ $Date$
**/
public class Portlets implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    private java.lang.String _id;

    private java.lang.String _name;

    private Controller _controller;

    private Control _control;

    private Layout _layout;

    private Skin _skin;

    private java.util.Vector _parameterList;

    private Metainfo _metainfo;

    private java.util.Vector _entryList;

    private java.util.Vector _portletsList;


      //----------------/
     //- Constructors -/
    //----------------/

    public Portlets() {
        super();
        _parameterList = new Vector();
        _entryList = new Vector();
        _portletsList = new Vector();
    } //-- org.apache.jetspeed.xml.api.portletmarkup.Portlets()


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * 
     * @param vEntry
    **/
    public void addEntry(Entry vEntry)
        throws java.lang.IndexOutOfBoundsException
    {
        _entryList.addElement(vEntry);
    } //-- void addEntry(Entry) 

    /**
     * 
     * @param vParameter
    **/
    public void addParameter(Parameter vParameter)
        throws java.lang.IndexOutOfBoundsException
    {
        _parameterList.addElement(vParameter);
    } //-- void addParameter(Parameter) 

    /**
     * 
     * @param vPortlets
    **/
    public void addPortlets(Portlets vPortlets)
        throws java.lang.IndexOutOfBoundsException
    {
        _portletsList.addElement(vPortlets);
    } //-- void addPortlets(Portlets) 

    /**
    **/
    public java.util.Enumeration enumerateEntry()
    {
        return _entryList.elements();
    } //-- java.util.Enumeration enumerateEntry() 

    /**
    **/
    public java.util.Enumeration enumerateParameter()
    {
        return _parameterList.elements();
    } //-- java.util.Enumeration enumerateParameter() 

    /**
    **/
    public java.util.Enumeration enumeratePortlets()
    {
        return _portletsList.elements();
    } //-- java.util.Enumeration enumeratePortlets() 

    /**
    **/
    public Control getControl()
    {
        return this._control;
    } //-- Control getControl() 

    /**
    **/
    public Controller getController()
    {
        return this._controller;
    } //-- Controller getController() 

    /**
     * 
     * @param index
    **/
    public Entry getEntry(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _entryList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (Entry) _entryList.elementAt(index);
    } //-- Entry getEntry(int) 

    /**
    **/
    public Entry[] getEntry()
    {
        int size = _entryList.size();
        Entry[] mArray = new Entry[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (Entry) _entryList.elementAt(index);
        }
        return mArray;
    } //-- Entry[] getEntry() 

    /**
    **/
    public int getEntryCount()
    {
        return _entryList.size();
    } //-- int getEntryCount() 

    /**
    **/
    public java.lang.String getId()
    {
        return this._id;
    } //-- java.lang.String getId() 

    /**
    **/
    public Layout getLayout()
    {
        return this._layout;
    } //-- Layout getLayout() 

    /**
    **/
    public Metainfo getMetainfo()
    {
        return this._metainfo;
    } //-- Metainfo getMetainfo() 

    /**
    **/
    public java.lang.String getName()
    {
        return this._name;
    } //-- java.lang.String getName() 

    /**
     * 
     * @param index
    **/
    public Parameter getParameter(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _parameterList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (Parameter) _parameterList.elementAt(index);
    } //-- Parameter getParameter(int) 

    /**
    **/
    public Parameter[] getParameter()
    {
        int size = _parameterList.size();
        Parameter[] mArray = new Parameter[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (Parameter) _parameterList.elementAt(index);
        }
        return mArray;
    } //-- Parameter[] getParameter() 

    /**
    **/
    public int getParameterCount()
    {
        return _parameterList.size();
    } //-- int getParameterCount() 

    /**
     * 
     * @param index
    **/
    public Portlets getPortlets(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _portletsList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (Portlets) _portletsList.elementAt(index);
    } //-- Portlets getPortlets(int) 

    /**
    **/
    public Portlets[] getPortlets()
    {
        int size = _portletsList.size();
        Portlets[] mArray = new Portlets[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (Portlets) _portletsList.elementAt(index);
        }
        return mArray;
    } //-- Portlets[] getPortlets() 

    /**
    **/
    public int getPortletsCount()
    {
        return _portletsList.size();
    } //-- int getPortletsCount() 

    /**
    **/
    public Skin getSkin()
    {
        return this._skin;
    } //-- Skin getSkin() 

    /**
    **/
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * 
     * @param out
    **/
    public void marshal(java.io.Writer out)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * 
     * @param handler
    **/
    public void marshal(org.xml.sax.DocumentHandler handler)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.DocumentHandler) 

    /**
    **/
    public void removeAllEntry()
    {
        _entryList.removeAllElements();
    } //-- void removeAllEntry() 

    /**
    **/
    public void removeAllParameter()
    {
        _parameterList.removeAllElements();
    } //-- void removeAllParameter() 

    /**
    **/
    public void removeAllPortlets()
    {
        _portletsList.removeAllElements();
    } //-- void removeAllPortlets() 

    /**
     * 
     * @param index
    **/
    public Entry removeEntry(int index)
    {
        Object obj = _entryList.elementAt(index);
        _entryList.removeElementAt(index);
        return (Entry) obj;
    } //-- Entry removeEntry(int) 

    /**
     * 
     * @param index
    **/
    public Parameter removeParameter(int index)
    {
        Object obj = _parameterList.elementAt(index);
        _parameterList.removeElementAt(index);
        return (Parameter) obj;
    } //-- Parameter removeParameter(int) 

    /**
     * 
     * @param index
    **/
    public Portlets removePortlets(int index)
    {
        Object obj = _portletsList.elementAt(index);
        _portletsList.removeElementAt(index);
        return (Portlets) obj;
    } //-- Portlets removePortlets(int) 

    /**
     * 
     * @param control
    **/
    public void setControl(Control control)
    {
        this._control = control;
    } //-- void setControl(Control) 

    /**
     * 
     * @param controller
    **/
    public void setController(Controller controller)
    {
        this._controller = controller;
    } //-- void setController(Controller) 

    /**
     * 
     * @param index
     * @param vEntry
    **/
    public void setEntry(int index, Entry vEntry)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _entryList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _entryList.setElementAt(vEntry, index);
    } //-- void setEntry(int, Entry) 

    /**
     * 
     * @param entryArray
    **/
    public void setEntry(Entry[] entryArray)
    {
        //-- copy array
        _entryList.removeAllElements();
        for (int i = 0; i < entryArray.length; i++) {
            _entryList.addElement(entryArray[i]);
        }
    } //-- void setEntry(Entry) 

    /**
     * 
     * @param id
    **/
    public void setId(java.lang.String id)
    {
        this._id = id;
    } //-- void setId(java.lang.String) 

    /**
     * 
     * @param layout
    **/
    public void setLayout(Layout layout)
    {
        this._layout = layout;
    } //-- void setLayout(Layout) 

    /**
     * 
     * @param metainfo
    **/
    public void setMetainfo(Metainfo metainfo)
    {
        this._metainfo = metainfo;
    } //-- void setMetainfo(Metainfo) 

    /**
     * 
     * @param name
    **/
    public void setName(java.lang.String name)
    {
        this._name = name;
    } //-- void setName(java.lang.String) 

    /**
     * 
     * @param index
     * @param vParameter
    **/
    public void setParameter(int index, Parameter vParameter)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _parameterList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _parameterList.setElementAt(vParameter, index);
    } //-- void setParameter(int, Parameter) 

    /**
     * 
     * @param parameterArray
    **/
    public void setParameter(Parameter[] parameterArray)
    {
        //-- copy array
        _parameterList.removeAllElements();
        for (int i = 0; i < parameterArray.length; i++) {
            _parameterList.addElement(parameterArray[i]);
        }
    } //-- void setParameter(Parameter) 

    /**
     * 
     * @param index
     * @param vPortlets
    **/
    public void setPortlets(int index, Portlets vPortlets)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _portletsList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _portletsList.setElementAt(vPortlets, index);
    } //-- void setPortlets(int, Portlets) 

    /**
     * 
     * @param portletsArray
    **/
    public void setPortlets(Portlets[] portletsArray)
    {
        //-- copy array
        _portletsList.removeAllElements();
        for (int i = 0; i < portletsArray.length; i++) {
            _portletsList.addElement(portletsArray[i]);
        }
    } //-- void setPortlets(Portlets) 

    /**
     * 
     * @param skin
    **/
    public void setSkin(Skin skin)
    {
        this._skin = skin;
    } //-- void setSkin(Skin) 

    /**
     * 
     * @param reader
    **/
    public static org.apache.jetspeed.xml.api.portletmarkup.Portlets unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (org.apache.jetspeed.xml.api.portletmarkup.Portlets) Unmarshaller.unmarshal(org.apache.jetspeed.xml.api.portletmarkup.Portlets.class, reader);
    } //-- org.apache.jetspeed.xml.api.portletmarkup.Portlets unmarshal(java.io.Reader) 

    /**
    **/
    public void validate()
        throws org.exolab.castor.xml.ValidationException
    {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}

