Author: akushunin
Date: 2007-07-20 11:10:54 -0400 (Fri, 20 Jul 2007)
New Revision: 1745
Modified:
trunk/sandbox/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java
trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
Log:
calendar-sample updated...
Modified:
trunk/sandbox/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java
===================================================================
---
trunk/sandbox/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java 2007-07-20
15:10:16 UTC (rev 1744)
+++
trunk/sandbox/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java 2007-07-20
15:10:54 UTC (rev 1745)
@@ -23,12 +23,61 @@
import java.util.Locale;
+import javax.faces.event.ValueChangeEvent;
+
/**
- * @author $Autor$
+ * 20/07/2007
+ * @author Alexej Kushunin
+ * @mailto: akushunin(a)exadel.com
*
*/
public class CalendarBean {
+
+ private Locale locale;
+ private boolean popup;
+ private String pattern;
+
+
public Locale getLocale() {
- return Locale.US;
+ return locale;
}
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+
+ public boolean isPopup() {
+ return popup;
+ }
+
+ public void setPopup(boolean popup) {
+ this.popup = popup;
+ }
+
+
+ public String getPattern() {
+ return pattern;
+ }
+
+ public void setPattern(String pattern) {
+ this.pattern = pattern;
+ }
+
+ public CalendarBean() {
+
+ locale = Locale.US;
+ popup = false;
+ pattern = "d/M/yy";
+ }
+
+ public void selectLocale(ValueChangeEvent event){
+
+ String tLocale = (String) event.getNewValue();
+ String lang = tLocale.substring(0,2);
+ String country = tLocale.substring(3);
+ locale = new Locale(lang,country,"");
+ }
+
+
}
\ No newline at end of file
Modified: trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
===================================================================
--- trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp 2007-07-20
15:10:16 UTC (rev 1744)
+++ trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp 2007-07-20
15:10:54 UTC (rev 1745)
@@ -1,6 +1,6 @@
<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib
uri="http://richfaces.ajax4jsf.org/calendar"
prefix="calendar" %>
+<%@ taglib
uri="http://labs.jboss.com/jbossrichfaces/ui/ui/calendar"
prefix="calendar" %>
<html>
<head>
<title></title>
@@ -8,9 +8,32 @@
<body>
<f:view>
<h:form>
- <calendar:calendar id="calendar" >
- </calendar:calendar>
+
+ <calendar:calendar
+ id="calendar"
+ locale="#{calendarBean.locale}"
+ popup="#{calendarBean.popup}"
+ datePattern="#{calendarBean.pattern}">
+ </calendar:calendar>
+ <h:panelGrid columns="2">
+ <h:outputText value="Select Locale:" />
+ <h:selectOneRadio onchange="submit()"
valueChangeListener="#{calendarBean.selectLocale}">
+ <f:selectItem itemLabel="US" itemValue="en/US"/>
+ <f:selectItem itemLabel="EN" itemValue="en/GB"/>
+ <f:selectItem itemLabel="FR" itemValue="fr/FR"/>
+ </h:selectOneRadio>
+ <h:outputText value="Popup Mode:" />
+ <h:selectBooleanCheckbox value="#{calendarBean.locale}"
onclick="submit()"/>
+ <h:outputText value="Select Date Pattern:"/>
+ <h:selectOneMenu value="#{calendarBean.pattern}"
onchange="submit()">
+ <f:selectItem itemLabel="d/M/yy" itemValue="d/M/yy"/>
+ <f:selectItem itemLabel="dd/MM/yy"
itemValue="dd/MM/yy"/>
+ <f:selectItem itemLabel="d/MMM/y" itemValue="d/MMM/y"/>
+ <f:selectItem itemLabel="MMM d, yyyy"
itemValue="d/MMM/y"/>
+ </h:selectOneMenu>
+ </h:panelGrid>
+
</h:form>
</f:view>
</body>