View Javadoc
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   * The tag class for the <code>s:validatorScript</code> tag.
11   */
12  public class BinaryFileTag
13      extends UIComponentTag
14  {
15      /**
16       * Sets properties for the component.
17       *
18       * @param component The component whose properties we're setting
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       * @see javax.faces.webapp.UIComponentTag#getRendererType()
33       */
34      @Override
35      public String getRendererType()
36      {
37          return BinaryFile.RENDERER_TYPE;
38      }
39  
40      /**
41       * The component type.
42       */
43      private static final String COMPONENT_TYPE = BinaryFile.COMPONENT_TYPE;
44  
45      /**
46       * Returns the component type.
47       */
48      @Override
49      public String getComponentType()
50      {
51          return COMPONENT_TYPE;
52      }
53  
54      private String value;
55  
56      /**
57       * Sets the value.
58       *
59       * @return Returns the value.
60       */
61      public String getValue()
62      {
63          return this.value;
64      }
65  
66      /**
67       * Gets the value.
68       *
69       * @param value The value to set.
70       */
71      public void setValue(String value)
72      {
73          this.value = value;
74      }
75  
76      private String fileName;
77  
78      /**
79       * @return Returns the fileName.
80       */
81      public String getFileName()
82      {
83          return this.fileName;
84      }
85  
86      /**
87       * @param fileName The fileName to set.
88       */
89      public void setFileName(String fileName)
90      {
91          this.fileName = fileName;
92      }
93  
94      private String contentType;
95  
96      /**
97       * @return Returns the contentType.
98       */
99      public String getContentType()
100     {
101         return this.contentType;
102     }
103 
104     /**
105      * @param contentType The contentType to set.
106      */
107     public void setContentType(String contentType)
108     {
109         this.contentType = contentType;
110     }
111 
112     private String encoding;
113 
114     /**
115      * @return Returns the encoding.
116      */
117     public String getEncoding()
118     {
119         return this.encoding;
120     }
121 
122     /**
123      * @param encoding The encoding to set.
124      */
125     public void setEncoding(String encoding)
126     {
127         this.encoding = encoding;
128     }
129 
130     private String prompt;
131 
132     /**
133      * @return Returns the prompt.
134      */
135     public String getPrompt()
136     {
137         return this.prompt;
138     }
139 
140     /**
141      * @param prompt The prompt to set.
142      */
143     public void setPrompt(String prompt)
144     {
145         this.prompt = prompt;
146     }
147 }