Author: andrei_exadel
Date: 2008-03-13 09:44:43 -0400 (Thu, 13 Mar 2008)
New Revision: 6779
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
Log:
RF-2484
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
---
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-13
12:50:02 UTC (rev 6778)
+++
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-03-13
13:44:43 UTC (rev 6779)
@@ -78,15 +78,17 @@
"uploadControlLabel", "stopControlLabel",
"clearAllControlLabel",
"cancelEntryControlLabel", "clearControlLabel",
"stopEntryControlLabel", null, null, null };
-
/**
* Overrides standard JSF component method.
- * @param context faces context
- * @param component file upload component
+ *
+ * @param context
+ * faces context
+ * @param component
+ * file upload component
*/
@Override
- @SuppressWarnings ("unchecked")
+ @SuppressWarnings("unchecked")
protected void doDecode(FacesContext context, UIComponent component) {
UIFileUpload fileUpload = (UIFileUpload) component;
ServletRequest request = (ServletRequest) context.getExternalContext()
@@ -118,27 +120,30 @@
}
}
-
-
- /**
- * Generates map with internalized labels to be put into JS
- * @param o map of labels
- * @return javascript hash map
- */
+
+ /**
+ * Generates map with internalized labels to be put into JS
+ *
+ * @param o
+ * map of labels
+ * @return javascript hash map
+ */
public Object _getLabels(Object o) {
return ScriptUtils.toScript(o);
}
-
-
- /**
- * Gets internalized labels.
- * At the first system is looking for them in appropriate attributes if they are
defined.
- * Next search place is application and file upload bundles.
- * If no result - default label value will be set up.
- * @param context facesContext instance
- * @param component UIComponent
- * @return map of labels
- */
+
+ /**
+ * Gets internalized labels. At the first system is looking for them in
+ * appropriate attributes if they are defined. Next search place is
+ * application and file upload bundles. If no result - default label value
+ * will be set up.
+ *
+ * @param context
+ * facesContext instance
+ * @param component
+ * UIComponent
+ * @return map of labels
+ */
public Map<String, String> getLabels(FacesContext context,
UIComponent component) {
Map<String, String> labelsMap = new HashMap<String, String>();
@@ -167,15 +172,18 @@
initLabels(labelsMap, bundle1, bundle2, fileUpload);
return labelsMap;
}
-
-
- /**
- * Sets values for labels.
- * @param map map of labels
- * @param bundle1 application bundle
- * @param bundle2 file upload bundle
- * @param fileUpload
- */
+
+ /**
+ * Sets values for labels.
+ *
+ * @param map
+ * map of labels
+ * @param bundle1
+ * application bundle
+ * @param bundle2
+ * file upload bundle
+ * @param fileUpload
+ */
private void initLabels(Map<String, String> map, ResourceBundle bundle1,
ResourceBundle bundle2, UIFileUpload fileUpload) {
int i = 0;
@@ -203,12 +211,15 @@
}
}
- /**
- * Looking for labels name in bundles provided.
- * @param bundle1 application bundle
- * @param bundle2 file upload bundle
- * @return String label value
- */
+ /**
+ * Looking for labels name in bundles provided.
+ *
+ * @param bundle1
+ * application bundle
+ * @param bundle2
+ * file upload bundle
+ * @return String label value
+ */
private String getFromBundle(String name, ResourceBundle bundle1,
ResourceBundle bundle2) {
name = bundlePrefix + name.toUpperCase() + bundlePostfix;
@@ -269,20 +280,19 @@
Object file) {
ValueExpression data = fileUpload
.getValueExpression(_FILES_UPLOADED_ATTRIBUTE_NAME);
+ UploadItem item = new UploadItem(fileUpload.getLocalFileName(), file);
if (data != null) {
if (data.getValue(context.getELContext()) instanceof Collection) {
Collection collection = (Collection) data.getValue(context
.getELContext());
if (checkFileCount(fileUpload, collection)) {
- UploadItem item = new UploadItem(fileUpload
- .getLocalFileName(), file);
- new UploadEvent(fileUpload, item).queue();
collection.add(item);
} else {
throw new FileUploadException("Files count overflow");
}
}
}
+ new UploadEvent(fileUpload, item).queue();
}
/**
Show replies by date