1 package org.andromda.cartridges.jsf.taglib;
2
3 import javax.faces.component.UIComponent;
4 import javax.faces.context.FacesContext;
5 import javax.faces.webapp.UIComponentTag;
6 import org.andromda.cartridges.jsf.component.BinaryFile;
7 import org.andromda.cartridges.jsf.utils.ComponentUtils;
8
9
10
11
12 public class BinaryFileTag
13 extends UIComponentTag
14 {
15
16
17
18
19
20 @Override
21 public void setProperties(final UIComponent component)
22 {
23 final FacesContext context = this.getFacesContext();
24 ComponentUtils.setValueProperty(context, component, this.getValue());
25 ComponentUtils.setStringProperty(BinaryFile.FILE_NAME_ATTRIBUTE, context, component, this.getFileName());
26 ComponentUtils.setStringProperty(BinaryFile.CONTENT_TYPE_ATTRIBUTE, context, component, this.getContentType());
27 ComponentUtils.setBooleanProperty(BinaryFile.PROMPT_ATTRIBUTE, context, component, this.getPrompt());
28 super.setProperties(component);
29 }
30
31
32
33
34 @Override
35 public String getRendererType()
36 {
37 return BinaryFile.RENDERER_TYPE;
38 }
39
40
41
42
43 private static final String COMPONENT_TYPE = BinaryFile.COMPONENT_TYPE;
44
45
46
47
48 @Override
49 public String getComponentType()
50 {
51 return COMPONENT_TYPE;
52 }
53
54 private String value;
55
56
57
58
59
60
61 public String getValue()
62 {
63 return this.value;
64 }
65
66
67
68
69
70
71 public void setValue(String value)
72 {
73 this.value = value;
74 }
75
76 private String fileName;
77
78
79
80
81 public String getFileName()
82 {
83 return this.fileName;
84 }
85
86
87
88
89 public void setFileName(String fileName)
90 {
91 this.fileName = fileName;
92 }
93
94 private String contentType;
95
96
97
98
99 public String getContentType()
100 {
101 return this.contentType;
102 }
103
104
105
106
107 public void setContentType(String contentType)
108 {
109 this.contentType = contentType;
110 }
111
112 private String encoding;
113
114
115
116
117 public String getEncoding()
118 {
119 return this.encoding;
120 }
121
122
123
124
125 public void setEncoding(String encoding)
126 {
127 this.encoding = encoding;
128 }
129
130 private String prompt;
131
132
133
134
135 public String getPrompt()
136 {
137 return this.prompt;
138 }
139
140
141
142
143 public void setPrompt(String prompt)
144 {
145 this.prompt = prompt;
146 }
147 }