Author: akushunin
Date: 2008-01-11 05:32:14 -0500 (Fri, 11 Jan 2008)
New Revision: 5291
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
Log:
RF-1461
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-01-11
10:29:56 UTC (rev 5290)
+++
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-01-11
10:32:14 UTC (rev 5291)
@@ -518,13 +518,13 @@
return result;
}
- public void writeStringFromBundle(ResourceBundle bundle1, ResourceBundle bundle2, String
name,
+ public void writeStringsFromBundle(ResourceBundle bundle1, ResourceBundle bundle2,
String name,
ResponseWriter writer) throws IOException {
String label = null;
try {
if(null != bundle1){
- label = bundle1.getString(name.toUpperCase() + "_LABEL");
+ label = bundle1.getString("RICH_CALENDAR_" + name.toUpperCase() +
"_LABEL");
}
} catch (MissingResourceException e) {
@@ -532,25 +532,32 @@
try {
if(null != bundle2){
- label = bundle2.getString(name.toUpperCase() + "_LABEL");
+ label = bundle2.getString("RICH_CALENDAR_" + name.toUpperCase() +
"_LABEL");
}
} catch (MissingResourceException exc) {
- // Current key wasn't found, use default
- if (!("close").equals(name.toLowerCase())) {
- writer.writeText(name.toLowerCase() + ":'" + name + "',
", null);
- } else {
- writer.writeText("close:'x' ", null);
- }
- return;
+ // Current key wasn't found, use default, ignore this exception.
}
- }
-
+ }
+ writeStringFoundInBundle(name, label, writer);
+
+ }
+
+ public void writeStringFoundInBundle(String name, String value, ResponseWriter writer)
throws IOException {
+ if(null!=value){
if (!("close").equals(name.toLowerCase())) {
- writer.writeText(name.toLowerCase() + ":'" + label + "',
",null);
+ writer.writeText(name.toLowerCase() + ":'" + value + "',
",null);
} else {
- writer.writeText("close:'"+label+"'", null);
+ writer.writeText("close:'" + value + "'", null);
}
- }
+ }else{
+ if (!("close").equals(name.toLowerCase())) {
+ writer.writeText(name.toLowerCase() + ":'" + name + "',
",null);
+ } else {
+ writer.writeText("close:'x'", null);
+ }
+ }
+
+ }
public void writeLabels(FacesContext context, UICalendar calendar)
throws IOException {
@@ -573,12 +580,12 @@
ResponseWriter writer = context.getResponseWriter();
writer.writeText(",\n labels:{", null);
if (null != bundle1 || null != bundle2) {
- writeStringFromBundle(bundle1, bundle2, "Apply", writer);
- writeStringFromBundle(bundle1, bundle2, "Today", writer);
- writeStringFromBundle(bundle1, bundle2, "Clean", writer);
- writeStringFromBundle(bundle1, bundle2, "Cancel", writer);
- writeStringFromBundle(bundle1, bundle2, "OK", writer);
- writeStringFromBundle(bundle1, bundle2, "Close", writer);
+ writeStringsFromBundle(bundle1, bundle2, "Apply", writer);
+ writeStringsFromBundle(bundle1, bundle2, "Today", writer);
+ writeStringsFromBundle(bundle1, bundle2, "Clean", writer);
+ writeStringsFromBundle(bundle1, bundle2, "Cancel", writer);
+ writeStringsFromBundle(bundle1, bundle2, "OK", writer);
+ writeStringsFromBundle(bundle1, bundle2, "Close", writer);
}else{
// No bundles were found, use default labels.
writer.writeText("apply:'Apply', today:'Today',
clean:'Clean', ok:'OK', cancel:'Cancel', close:'x'",
null);