KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > extensions > forms > DefaultExtensionsForm


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

19             
20
21 package com.sslexplorer.extensions.forms;
22
23 import java.util.Collection JavaDoc;
24
25 import javax.servlet.http.HttpSession JavaDoc;
26
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29
30 import com.sslexplorer.core.actions.AbstractMultiFormDispatchAction.SubActionWrapper;
31 import com.sslexplorer.core.forms.CoreForm;
32 import com.sslexplorer.extensions.ExtensionBundle;
33 import com.sslexplorer.extensions.ExtensionBundleItem;
34 import com.sslexplorer.extensions.ExtensionBundleItemModel;
35 import com.sslexplorer.table.forms.AbstractPagerForm;
36
37 public class DefaultExtensionsForm extends AbstractPagerForm {
38     static final long serialVersionUID = 4283488241230531541L;
39     private static final Log logger = LogFactory.getLog(DefaultExtensionsForm.class);
40     
41     private String JavaDoc submitAction = null;
42     private String JavaDoc subFormName = null;
43     
44
45     public String JavaDoc getSubFormName() {
46         return subFormName;
47     }
48
49     public void setSubFormName(String JavaDoc subFormName) {
50         this.subFormName = subFormName;
51     }
52
53     public DefaultExtensionsForm(String JavaDoc submitAction, String JavaDoc subFormName) {
54         super(new ExtensionBundleItemModel());
55         this.submitAction = submitAction + "?subForm=" + subFormName;
56         this.subFormName = subFormName;
57     }
58
59     public String JavaDoc getSubmitAction() {
60         return submitAction;
61     }
62
63     public void setSubmitAction(String JavaDoc submitAction) {
64         this.submitAction = submitAction;
65     }
66
67     /**
68      * <p>
69      * Initialise the pager and the items and the ability to sort.
70      *
71      * @param session The session information.
72      * @param extensions Collection of ExtensionBundle
73      */

74     public void initialise(HttpSession JavaDoc session, Collection JavaDoc<ExtensionBundle> extensions) {
75         super.initialize(session, "name");
76
77         try {
78             for (ExtensionBundle bundle : extensions) {
79                 this.getModel().addItem(new ExtensionBundleItem(bundle, false, subFormName));
80             }
81
82             checkSort();
83             getPager().rebuild(getFilterText());
84         } catch (Throwable JavaDoc t) {
85             logger.error("Failed to initialise resources form.", t);
86         }
87     }
88 }
Popular Tags