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

package com.queplix.core.modules.config.jxb;

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

import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Enumeration;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;

/**
 * Describes row of the layout
 * 
 * @version $Revision$ $Date$
 */
public class Row extends com.queplix.core.utils.jxb.JXBObject 
implements java.io.Serializable
{


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

    /**
     * Order of the row
     */
    private java.lang.Integer _order;

    /**
     * Name of form which contain this row
     */
    private java.lang.String _form;

    /**
     * Describes cell of the row
     */
    private java.util.ArrayList _colList;


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

    public Row() 
     {
        super();
        _colList = new ArrayList();
    } //-- com.queplix.core.modules.config.jxb.Row()


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

    /**
     * Method addCol
     * 
     * 
     * 
     * @param vCol
     */
    public void addCol(com.queplix.core.modules.config.jxb.Col vCol)
        throws java.lang.IndexOutOfBoundsException
    {
        _colList.add(vCol);
    } //-- void addCol(com.queplix.core.modules.config.jxb.Col) 

    /**
     * Method addCol
     * 
     * 
     * 
     * @param index
     * @param vCol
     */
    public void addCol(int index, com.queplix.core.modules.config.jxb.Col vCol)
        throws java.lang.IndexOutOfBoundsException
    {
        _colList.add(index, vCol);
    } //-- void addCol(int, com.queplix.core.modules.config.jxb.Col) 

    /**
     * Method clearCol
     * 
     */
    public void clearCol()
    {
        _colList.clear();
    } //-- void clearCol() 

    /**
     * Method enumerateCol
     * 
     * 
     * 
     * @return Enumeration
     */
    public java.util.Enumeration enumerateCol()
    {
        return new org.exolab.castor.util.IteratorEnumeration(_colList.iterator());
    } //-- java.util.Enumeration enumerateCol() 

    /**
     * Method getCol
     * 
     * 
     * 
     * @param index
     * @return Col
     */
    public com.queplix.core.modules.config.jxb.Col getCol(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _colList.size())) {
            throw new IndexOutOfBoundsException();
        }
        
        return (com.queplix.core.modules.config.jxb.Col) _colList.get(index);
    } //-- com.queplix.core.modules.config.jxb.Col getCol(int) 

    /**
     * Method getCol
     * 
     * 
     * 
     * @return Col
     */
    public com.queplix.core.modules.config.jxb.Col[] getCol()
    {
        int size = _colList.size();
        com.queplix.core.modules.config.jxb.Col[] mArray = new com.queplix.core.modules.config.jxb.Col[size];
        for (int index = 0; index < size; index++) {
            mArray[index] = (com.queplix.core.modules.config.jxb.Col) _colList.get(index);
        }
        return mArray;
    } //-- com.queplix.core.modules.config.jxb.Col[] getCol() 

    /**
     * Method getColCount
     * 
     * 
     * 
     * @return int
     */
    public int getColCount()
    {
        return _colList.size();
    } //-- int getColCount() 

    /**
     * Returns the value of field 'form'. The field 'form' has the
     * following description: Name of form which contain this row
     * 
     * @return String
     * @return the value of field 'form'.
     */
    public java.lang.String getForm()
    {
        return this._form;
    } //-- java.lang.String getForm() 

    /**
     * Returns the value of field 'order'. The field 'order' has
     * the following description: Order of the row
     * 
     * @return Integer
     * @return the value of field 'order'.
     */
    public java.lang.Integer getOrder()
    {
        return this._order;
    } //-- java.lang.Integer getOrder() 

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

    /**
     * Method marshal
     * 
     * 
     * 
     * @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) 

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

    /**
     * Method removeCol
     * 
     * 
     * 
     * @param vCol
     * @return boolean
     */
    public boolean removeCol(com.queplix.core.modules.config.jxb.Col vCol)
    {
        boolean removed = _colList.remove(vCol);
        return removed;
    } //-- boolean removeCol(com.queplix.core.modules.config.jxb.Col) 

    /**
     * Method setCol
     * 
     * 
     * 
     * @param index
     * @param vCol
     */
    public void setCol(int index, com.queplix.core.modules.config.jxb.Col vCol)
        throws java.lang.IndexOutOfBoundsException
    {
        //-- check bounds for index
        if ((index < 0) || (index > _colList.size())) {
            throw new IndexOutOfBoundsException();
        }
        _colList.set(index, vCol);
    } //-- void setCol(int, com.queplix.core.modules.config.jxb.Col) 

    /**
     * Method setCol
     * 
     * 
     * 
     * @param colArray
     */
    public void setCol(com.queplix.core.modules.config.jxb.Col[] colArray)
    {
        //-- copy array
        _colList.clear();
        for (int i = 0; i < colArray.length; i++) {
            _colList.add(colArray[i]);
        }
    } //-- void setCol(com.queplix.core.modules.config.jxb.Col) 

    /**
     * Sets the value of field 'form'. The field 'form' has the
     * following description: Name of form which contain this row
     * 
     * @param form the value of field 'form'.
     */
    public void setForm(java.lang.String form)
    {
        this._form = form;
    } //-- void setForm(java.lang.String) 

    /**
     * Sets the value of field 'order'. The field 'order' has the
     * following description: Order of the row
     * 
     * @param order the value of field 'order'.
     */
    public void setOrder(java.lang.Integer order)
    {
        this._order = order;
    } //-- void setOrder(java.lang.Integer) 

    /**
     * Method unmarshal
     * 
     * 
     * 
     * @param reader
     * @return Object
     */
    public static java.lang.Object unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (com.queplix.core.modules.config.jxb.Row) Unmarshaller.unmarshal(com.queplix.core.modules.config.jxb.Row.class, reader);
    } //-- java.lang.Object unmarshal(java.io.Reader) 

    /**
     * Method validate
     * 
     */
    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() 

}
