Author: vbaranov
Date: 2008-03-26 08:14:45 -0400 (Wed, 26 Mar 2008)
New Revision: 7245
Modified:
branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
Log:
http://jira.jboss.com/jira/browse/RF-2482
Modified:
branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-03-26
12:09:36 UTC (rev 7244)
+++
branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-03-26
12:14:45 UTC (rev 7245)
@@ -523,28 +523,39 @@
return result;
}
+ /**
+ * Write labels used in the Calendar component, taken from message bundles.
+ * Try to use bundle1 at first. If the 1st bundle is null or it doesn't
+ * contain requested message key, use the bundle2.
+ * @param bundle1 - 1st bundle to be used as a source for messages
+ * @param bundle2 - 2nd bundle to be used as a source for messages
+ * @param name - name of the requested label
+ * @param writer - response writer
+ * @throws IOException
+ */
public void writeStringsFromBundle(ResourceBundle bundle1, ResourceBundle bundle2,
String name,
- ResponseWriter writer) throws IOException {
-
- String label = null;
+ ResponseWriter writer) throws IOException {
+ String label = null;
+ String bundleKey = "RICH_CALENDAR_" + name.toUpperCase() +
"_LABEL";
+
+ if (bundle1 != null) {
try {
- if(null != bundle1){
- label = bundle1.getString("RICH_CALENDAR_" + name.toUpperCase() +
"_LABEL");
- }
-
- } catch (MissingResourceException e) {
- // Current key wasn't found in application bundle, use CALENDAR_BUNDLE
- try {
-
- if(null != bundle2){
- label = bundle2.getString("RICH_CALENDAR_" + name.toUpperCase() +
"_LABEL");
- }
- } catch (MissingResourceException exc) {
- // Current key wasn't found, use default, ignore this exception.
- }
- }
- writeStringFoundInBundle(name, label, writer);
-
+ label = bundle1.getString(bundleKey);
+ } catch (MissingResourceException mre) {
+ // Current key was not found, ignore this exception;
+ }
+ }
+ // Current key wasn't found in application bundle, use CALENDAR_BUNDLE,
+ // if it is not null
+ if ((label == null) && (bundle2 != null)) {
+ try {
+ label = bundle2.getString(bundleKey);
+ } catch (MissingResourceException mre) {
+ // Current key was not found, ignore this exception;
+ }
+ }
+
+ writeStringFoundInBundle(name, label, writer);
}
public void writeStringFoundInBundle(String name, String value, ResponseWriter writer)
throws IOException {