KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > sample > forms > SampleForm


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 package com.sslexplorer.sample.forms;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26 import org.apache.struts.action.ActionErrors;
27 import org.apache.struts.action.ActionMapping;
28
29 import com.sslexplorer.boot.PropertyList;
30 import com.sslexplorer.input.MultiSelectSelectionModel;
31 import com.sslexplorer.policyframework.Resource;
32 import com.sslexplorer.policyframework.forms.AbstractFavoriteResourceForm;
33 import com.sslexplorer.security.User;
34
35 /**
36  * <p>
37  * Form for providing the attributes to be edited and validated.
38  *
39  * @author James D Robinson <a HREF="mailto:james@3sp.com">&lt;james@3sp.com&gt;</a>
40  *
41  */

42 public class SampleForm extends AbstractFavoriteResourceForm {
43     static Log log = LogFactory.getLog(SampleForm.class);
44
45     private String JavaDoc selectedTab = "details";
46
47     /*
48      * (non-Javadoc)
49      *
50      * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping,
51      * javax.servlet.http.HttpServletRequest)
52      */

53     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
54         ActionErrors errs = super.validate(mapping, request);
55         if (isCommiting()) {
56             // TODO any validation required.
57
}
58         return errs;
59     }
60
61     /*
62      * (non-Javadoc)
63      *
64      * @see com.sslexplorer.tabs.TabModel#getTabCount()
65      */

66     public int getTabCount() {
67         // TODO the number of tabs on edit.
68
return 3;
69     }
70
71     /*
72      * (non-Javadoc)
73      *
74      * @see com.sslexplorer.tabs.TabModel#getTabName(int)
75      */

76     public String JavaDoc getTabName(int idx) {
77         // TODO the name of the tab for column idx
78
switch (idx) {
79             case 0:
80                 return "details";
81             case 1:
82                 return "other";
83             default:
84                 return "policies";
85         }
86     }
87
88     /*
89      * (non-Javadoc)
90      *
91      * @see com.sslexplorer.policyframework.forms.AbstractResourceForm#initialise(com.sslexplorer.security.User,
92      * com.sslexplorer.boot.policyframework.Resource, boolean,
93      * com.sslexplorer.boot.MultiSelectSelectionModel,
94      * com.sslexplorer.boot.PropertyList, com.sslexplorer.security.User)
95      */

96     public void initialise(User user, Resource resource, boolean editing, MultiSelectSelectionModel policyModel,
97                     PropertyList selectedPolicies, User owner) throws Exception JavaDoc {
98         super.initialise(user, resource, editing, policyModel, selectedPolicies, owner);
99     }
100
101     /*
102      * (non-Javadoc)
103      *
104      * @see com.sslexplorer.tabs.TabModel#getSelectedTab()
105      */

106     public String JavaDoc getSelectedTab() {
107         return selectedTab;
108     }
109
110     /*
111      * (non-Javadoc)
112      *
113      * @see com.sslexplorer.tabs.TabModel#setSelectedTab(java.lang.String)
114      */

115     public void setSelectedTab(String JavaDoc selectedTab) {
116         this.selectedTab = selectedTab;
117     }
118
119     /* (non-Javadoc)
120      * @see com.sslexplorer.tabs.TabModel#getTabTitle(int)
121      */

122     public String JavaDoc getTabTitle(int i) {
123         // NOTE return null for to get the tab headings from resources (usually what you want)
124
return null;
125     }
126
127     /*
128      * (non-Javadoc)
129      *
130      * @see com.sslexplorer.policyframework.forms.AbstractResourceForm#applyToResource()
131      */

132     public void applyToResource() throws Exception JavaDoc {
133         /* TODO apply any additional values from the form to the current
134          * resource object (obtained usimg getResource())
135          */

136     }
137
138     /* (non-Javadoc)
139      * @see com.sslexplorer.tabs.TabModel#getTabBundle(int)
140      */

141     public String JavaDoc getTabBundle(int idx) {
142         return null;
143     }
144 }
Popular Tags