Package com.adito.extensions.forms

Source Code of com.adito.extensions.forms.DefaultExtensionsForm

        /*
*  Adito
*
*  Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
*
*  This program is free software; you can redistribute it and/or
*  modify it under the terms of the GNU General Public License
*  as published by the Free Software Foundation; either version 2 of
*  the License, or (at your option) any later version.
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public
*  License along with this program; if not, write to the Free Software
*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
     

package com.adito.extensions.forms;

import java.util.Collection;

import javax.servlet.http.HttpSession;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.adito.extensions.ExtensionBundle;
import com.adito.extensions.ExtensionBundleItem;
import com.adito.extensions.ExtensionBundleItemModel;
import com.adito.table.forms.AbstractPagerForm;

public class DefaultExtensionsForm extends AbstractPagerForm {
    static final long serialVersionUID = 4283488241230531541L;
    private static final Log logger = LogFactory.getLog(DefaultExtensionsForm.class);
   
    private String submitAction = null;
    private String subFormName = null;
   

    public String getSubFormName() {
        return subFormName;
    }

    public void setSubFormName(String subFormName) {
        this.subFormName = subFormName;
    }

    public DefaultExtensionsForm(String submitAction, String subFormName) {
        super(new ExtensionBundleItemModel());
        this.submitAction = submitAction;
        this.subFormName = subFormName;
    }

    public String getSubmitAction() {
        return submitAction;
    }

    public void setSubmitAction(String submitAction) {
        this.submitAction = submitAction;
    }

    /**
     * <p>
     * Initialise the pager and the items and the ability to sort.
     *
     * @param session The session information.
     * @param extensions Collection of ExtensionBundle
     */
    public void initialise(HttpSession session, Collection<ExtensionBundle> extensions) {
        super.initialize(session, "status");

        try {
            for (ExtensionBundle bundle : extensions) {
                this.getModel().addItem(new ExtensionBundleItem(bundle, false, subFormName));
            }

            checkSort();
            getPager().rebuild(getFilterText());
        } catch (Throwable t) {
            logger.error("Failed to initialise resources form.", t);
        }
    }
}
TOP

Related Classes of com.adito.extensions.forms.DefaultExtensionsForm

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.