KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > core > forms > AbstractFavoriteResourceDetailsWizardForm


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.core.forms;
21
22 import javax.servlet.http.HttpServletRequest JavaDoc;
23
24 import org.apache.struts.action.ActionMapping;
25
26 import com.sslexplorer.navigation.FavoriteResourceType;
27 import com.sslexplorer.wizard.AbstractWizardSequence;
28
29 /**
30  * Extension of {@link com.sslexplorer.core.forms.AbstractResourceDetailsWizardForm}
31  * that should be used for resources that support <i>Favorites</i>.
32  *
33  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
34  */

35 public abstract class AbstractFavoriteResourceDetailsWizardForm extends AbstractResourceDetailsWizardForm {
36
37     /**
38      * Wizard attribute for storing whether this resource should be
39      * created as a <i>Favorite</i>.
40      */

41     public static final String JavaDoc ATTR_FAVORITE = "favorite";
42     
43     // Private instance variables
44

45     private boolean favorite;
46     
47     /**
48      * Constructor
49      *
50      * @param nextAvailable next page available
51      * @param previousAvailable previous page available
52      * @param page page
53      * @param focussedField initial focussed field
54      * @param autoComplete auto complete enabled
55      * @param finishAvailable finish page available
56      * @param pageName page name
57      * @param resourceBundle message resources bundle bundle
58      * @param resourcePrefix messages resources prefix
59      * @param stepIndex step in wizard
60      * @param resourceTypeForAccessRights resource type
61      */

62     public AbstractFavoriteResourceDetailsWizardForm(boolean nextAvailable, boolean previousAvailable, String JavaDoc page, String JavaDoc focussedField,
63                                              boolean autoComplete, boolean finishAvailable, String JavaDoc pageName, String JavaDoc resourceBundle,
64                                              String JavaDoc resourcePrefix, int stepIndex, FavoriteResourceType resourceTypeForAccessRights) {
65         super(nextAvailable, previousAvailable, page, focussedField, autoComplete, finishAvailable, pageName, resourceBundle, resourcePrefix, stepIndex, resourceTypeForAccessRights);
66     }
67
68     /**
69      * Set whether this resource should be configured as <i>Global Favorite</i>
70      * or not.
71      *
72      * @param favorite favorite
73      */

74     public void setFavorite(boolean favorite) {
75         this.favorite = favorite;
76     }
77     
78     /**
79      * Get whether this resource should be configured as <i>Global Favorite</i>
80      * or not.
81      *
82      * @return favorite
83      */

84     public boolean getFavorite() {
85         return favorite;
86     }
87
88
89     
90     /* (non-Javadoc)
91      * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
92      */

93     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
94         super.reset(mapping, request);
95         AbstractWizardSequence sequence = this.getWizardSequence();
96          if (sequence != null){
97              if (this.getWizardSequence().getAttribute(ATTR_FAVORITE, "").toString().equals(""))
98                  favorite = false;
99          }
100     }
101     
102     /* (non-Javadoc)
103      * @see com.sslexplorer.wizard.forms.AbstractWizardForm#apply(com.sslexplorer.wizard.AbstractWizardSequence)
104      */

105     public void apply(AbstractWizardSequence sequence) throws Exception JavaDoc {
106         super.apply(sequence);
107         sequence.putAttribute(ATTR_FAVORITE, Boolean.valueOf(favorite));
108     }
109     
110 }
111
Popular Tags