KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > presentation > website > formbeans > RollerConfigFormEx


1
2 package org.roller.presentation.website.formbeans;
3
4 import javax.servlet.http.HttpServletRequest JavaDoc;
5
6 import org.apache.struts.action.ActionMapping;
7 import org.roller.RollerException;
8 import org.roller.pojos.RollerConfigData;
9 import org.roller.presentation.forms.RollerConfigForm;
10
11 /**
12  * These properties are not persistent and are only needed for the UI.
13  *
14  * @struts.form name="rollerConfigFormEx"
15  * @author Lance Lavandowska
16  */

17 public class RollerConfigFormEx extends RollerConfigForm
18 {
19     public RollerConfigFormEx()
20     {
21     }
22
23     public RollerConfigFormEx( RollerConfigData config, java.util.Locale JavaDoc locale ) throws RollerException
24     {
25         super(config, locale);
26     }
27
28     /**
29      * Override for non-primitive values
30      */

31     public void copyFrom(org.roller.pojos.RollerConfigData dataHolder, java.util.Locale JavaDoc locale) throws RollerException
32     {
33         super.copyFrom(dataHolder, locale);
34         fixNulls();
35         this.uploadMaxFileMB = dataHolder.getUploadMaxFileMB();
36         this.uploadMaxDirMB = dataHolder.getUploadMaxDirMB();
37     }
38
39     /**
40      * Override for non-primitive values
41      */

42     public void copyTo(org.roller.pojos.RollerConfigData dataHolder, java.util.Locale JavaDoc locale) throws RollerException
43     {
44         fixNulls();
45         super.copyTo(dataHolder, locale);
46         dataHolder.setUploadMaxFileMB(this.uploadMaxFileMB);
47         dataHolder.setUploadMaxDirMB(this.uploadMaxDirMB);
48     }
49
50     /**
51      * Method allows Struts to handle empty checkboxes for booleans
52      */

53     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request)
54     {
55         setAbsoluteURL( null );
56         fixNulls();
57     }
58     
59     private void fixNulls()
60     {
61         if (getRssUseCache() == null) setRssUseCache( Boolean.FALSE );
62         if (getNewUserAllowed() == null) setNewUserAllowed( Boolean.FALSE );
63         if (getEnableAggregator() == null) setEnableAggregator( Boolean.FALSE );
64         if (getUploadEnabled() == null) setUploadEnabled( Boolean.FALSE );
65         if (getMemDebug() == null) setMemDebug( Boolean.FALSE );
66         if (getAutoformatComments() == null) setAutoformatComments( Boolean.FALSE );
67         if (getEscapeCommentHtml() == null) setEscapeCommentHtml( Boolean.FALSE );
68         if (getEmailComments() == null) setEmailComments( Boolean.FALSE );
69         if (getEnableLinkback() == null) setEnableLinkback( Boolean.FALSE );
70         if (getEncryptPasswords() == null) setEncryptPasswords( Boolean.FALSE );
71     }
72 }
Popular Tags