/*
 * Copyright 2006-2007 Queplix Corp.
 *
 * Licensed under the Queplix Public License, Version 1.1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.queplix.com/solutions/commercial-open-source/queplix-public-license/
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 */

/*
 * 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;

/**
 * Set of buttons which shall be added into form
 * 
 * @version $Revision$ $Date$
 */
public class ButtonsSetType extends com.queplix.core.utils.jxb.JXBObject 
implements java.io.Serializable
{


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

    /**
     * Either use all common actions by default or not
     */
    private java.lang.Boolean _defaultactions = new java.lang.Boolean("true");

    /**
     * Button which shall be added into form
     */
    private java.util.ArrayList _buttonList;


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

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


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

    /**
     * Method addButton
     * 
     * 
     * 
     * @param vButton
     */
    public void addButton(com.queplix.core.modules.config.jxb.Button vButton)
        throws java.lang.IndexOutOfBoundsException
    {
        _buttonList.add(vButton);
    } //-- void addButton(com.queplix.core.modules.config.jxb.Button) 

    /**
     * Method addButton
     * 
     * 
     * 
     * @param index
     * @param vButton
     */
    public void addButton(int index, com.queplix.core.modules.config.jxb.Button vButton)
        throws java.lang.IndexOutOfBoundsException
    {
        _buttonList.add(index, vButton);
    } //-- void addButton(int, com.queplix.core.modules.config.jxb.Button) 

    /**
     * Method clearButton
     * 
     */
    public void clearButton()
    {
        _buttonList.clear();
    } //-- void clearButton() 

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

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

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

    /**
     * Method getButtonCount
     * 
     * 
     * 
     * @return int
     */
    public int getButtonCount()
    {
        return _buttonList.size();
    } //-- int getButtonCount() 

    /**
     * Returns the value of field 'defaultactions'. The field
     * 'defaultactions' has the following description: Either use
     * all common actions by default or not
     * 
     * @return Boolean
     * @return the value of field 'defaultactions'.
     */
    public java.lang.Boolean getDefaultactions()
    {
        return this._defaultactions;
    } //-- java.lang.Boolean getDefaultactions() 

    /**
     * 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 removeButton
     * 
     * 
     * 
     * @param vButton
     * @return boolean
     */
    public boolean removeButton(com.queplix.core.modules.config.jxb.Button vButton)
    {
        boolean removed = _buttonList.remove(vButton);
        return removed;
    } //-- boolean removeButton(com.queplix.core.modules.config.jxb.Button) 

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

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

    /**
     * Sets the value of field 'defaultactions'. The field
     * 'defaultactions' has the following description: Either use
     * all common actions by default or not
     * 
     * @param defaultactions the value of field 'defaultactions'.
     */
    public void setDefaultactions(java.lang.Boolean defaultactions)
    {
        this._defaultactions = defaultactions;
    } //-- void setDefaultactions(java.lang.Boolean) 

    /**
     * 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.ButtonsSetType) Unmarshaller.unmarshal(com.queplix.core.modules.config.jxb.ButtonsSetType.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() 

}
