KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > gui > dialog > DialogPassword


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.gui.dialog;
14
15 import info.magnolia.cms.gui.control.ControlImpl;
16 import info.magnolia.cms.gui.control.Password;
17 import info.magnolia.cms.gui.misc.CssConstants;
18
19 import java.io.IOException JavaDoc;
20 import java.io.Writer JavaDoc;
21
22 import org.apache.commons.lang.StringUtils;
23
24
25 /**
26  * @author Vinzenz Wyser
27  * @version 2.0
28  */

29 public class DialogPassword extends DialogBox {
30
31     /**
32      * Empty constructor should only be used by DialogFactory.
33      */

34     protected DialogPassword() {
35     }
36
37     /**
38      * @see info.magnolia.cms.gui.dialog.DialogControl#drawHtml(Writer)
39      */

40     public void drawHtml(Writer JavaDoc out) throws IOException JavaDoc {
41         Password control = new Password(this.getName(), this.getValue());
42         if (this.getConfigValue("saveInfo").equals("false")) { //$NON-NLS-1$ //$NON-NLS-2$
43
control.setSaveInfo(false);
44         }
45         control.setCssClass(CssConstants.CSSCLASS_EDIT);
46         control.setCssStyles("width", this.getConfigValue("width", "100%")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
47
control.setEncoding(ControlImpl.ENCODING_BASE64);
48         if (this.getConfigValue("onchange", null) != null) { //$NON-NLS-1$
49
control.setEvent("onchange", this.getConfigValue("onchange")); //$NON-NLS-1$ //$NON-NLS-2$
50
}
51         this.drawHtmlPre(out);
52         out.write(control.getHtml());
53         if (this.getConfigValue("verification", "true").equals("true")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
54
Password control2 = new Password(this.getName() + "_verification", StringUtils.EMPTY); //$NON-NLS-1$
55
// Password control2=new Password(this.getName()+"_verifiaction",this.getValue());
56
// control2.setEncoding(ControlImpl.ENCODING_UNIX);
57
control2.setSaveInfo(false);
58             control2.setCssClass(CssConstants.CSSCLASS_EDIT);
59             control2.setCssStyles("width", //$NON-NLS-1$
60
this.getConfigValue("width", "100%")); //$NON-NLS-1$ //$NON-NLS-2$
61
control2.setEvent("onchange", //$NON-NLS-1$
62
"mgnlDialogPasswordVerify('" + this.getName() + "')"); //$NON-NLS-1$ //$NON-NLS-2$
63
// todo: verification on submit; think about
64
out.write("<div class=\"" //$NON-NLS-1$
65
+ CssConstants.CSSCLASS_DESCRIPTION
66                 + "\">" //$NON-NLS-1$
67
+ getMessage("dialog.password.verify") //$NON-NLS-1$
68
+ "</div>"); //$NON-NLS-1$
69
out.write(control2.getHtml());
70         }
71         this.drawHtmlPost(out);
72     }
73 }
74
Popular Tags