AT&T 2.0.19 Code drop, stage 4
[aaf/authz.git] / authz-gui / src / main / java / com / att / authz / gui / Form.java
1 /*******************************************************************************
2  * Copyright (c) 2016 AT&T Intellectual Property. All rights reserved.
3  *******************************************************************************/
4 package com.att.authz.gui;
5
6 import java.io.IOException;
7
8 import org.onap.aaf.inno.env.APIException;
9 import com.att.xgen.Cache;
10 import com.att.xgen.html.HTMLGen;
11
12 public class Form extends NamedCode {
13         private String preamble;
14         private NamedCode content;
15         
16         public Form(boolean no_cache, NamedCode content) {
17                 super(no_cache,content.idattrs());
18                 this.content = content;
19                 preamble=null;
20                 idattrs = content.idattrs();
21         }
22         
23         public Form preamble(String preamble) {
24                 this.preamble = preamble;
25                 return this;
26         }
27         
28
29         @Override
30         public void code(Cache<HTMLGen> cache, HTMLGen hgen) throws APIException, IOException {
31                 if(preamble!=null) {
32                         hgen.incr("p","class=preamble").text(preamble).end();
33                 }
34                 hgen.incr("form","method=post");
35         
36                 content.code(cache, hgen);
37                 
38                 hgen.tagOnly("input", "type=submit", "value=Submit")
39                         .tagOnly("input", "type=reset", "value=Reset")
40                 .end();
41         }
42
43         /* (non-Javadoc)
44          * @see com.att.authz.gui.NamedCode#idattrs()
45          */
46         @Override
47         public String[] idattrs() {
48                 return content.idattrs();
49         }
50
51 }