[richfaces-svn-commits] JBoss Rich Faces SVN: r2425 - trunk/samples/calendar-sample/src/main/java/org/richfaces.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Aug 23 04:32:16 EDT 2007


Author: pyaschenko
Date: 2007-08-23 04:32:15 -0400 (Thu, 23 Aug 2007)
New Revision: 2425

Modified:
   trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java
Log:


Modified: trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java
===================================================================
--- trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java	2007-08-23 08:06:30 UTC (rev 2424)
+++ trunk/samples/calendar-sample/src/main/java/org/richfaces/CalendarBean.java	2007-08-23 08:32:15 UTC (rev 2425)
@@ -1,10 +1,202 @@
-			rich:calendar allows to select the date using monthly calendar elements on pages.
-			It is possoble to use the component in popup and inline code. Calendar at popup mode
-			 initially renders as input for date and button on the right side to call popup.
-			 Also initially Calendar should be loaded to client for the initial date.
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
 
-			 If no initial date – it should be loaded for current date but input must be empty.
-			 On the button click - it must be shown. If the date was changed in the text from
-			 initial field manually – ajax request may (or may not) be sent to show the calendar
-			 for the corresponding date.
+package org.richfaces;
 
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import javax.faces.event.ValueChangeEvent;
+
+/**
+ * 20/07/2007
+ * 
+ * @author Alexej Kushunin
+ * @mailto: akushunin at exadel.com
+ * 
+ */
+public class CalendarBean {
+
+	private static final String[] WEEK_DAY_LABELS = new String[] { "Sun *",
+			"Mon +", "Tue +", "Wed +", "Thu +", "Fri +", "Sat *" };
+	private Locale locale;
+
+	private boolean popup;
+	private boolean readonly;
+	private boolean showInput;
+	private boolean enableManualInput;	
+	private String pattern;
+	private Date currentDate;
+	private Date selectedDate;
+	private String jointPoint;
+	private String direction;
+	private String boundary;
+
+	private boolean useCustomDayLabels;
+
+	public Locale getLocale() {
+		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 = true;
+		pattern = "MMM d, yyyy";
+		jointPoint = "bottom-left";
+		direction = "bottom-right";
+		readonly = true;
+		enableManualInput=false;
+		showInput=true;
+		boundary = "inactive";
+	}
+	
+	
+	public boolean isShowInput() {
+		return showInput;
+	}
+
+	public void setShowInput(boolean showInput) {
+		this.showInput = showInput;
+	}
+
+	public boolean isEnableManualInput() {
+		return enableManualInput;
+	}
+
+	public void setEnableManualInput(boolean enableManualInput) {
+		this.enableManualInput = enableManualInput;
+	}
+
+	public boolean isReadonly() {
+		return readonly;
+	}
+
+	public void setReadonly(boolean readonly) {
+		this.readonly = readonly;
+	}
+
+	public void selectLocale(ValueChangeEvent event) {
+
+		String tLocale = (String) event.getNewValue();
+		if (tLocale != null) {
+			String lang = tLocale.substring(0, 2);
+			String country = tLocale.substring(3);
+			locale = new Locale(lang, country, "");
+		}
+	}
+
+	public boolean isUseCustomDayLabels() {
+		return useCustomDayLabels;
+	}
+
+	public void setUseCustomDayLabels(boolean useCustomDayLabels) {
+		this.useCustomDayLabels = useCustomDayLabels;
+	}
+
+	public Object getWeekDayLabelsShort() {
+		if (isUseCustomDayLabels()) {
+			return WEEK_DAY_LABELS;
+		} else {
+			return null;
+		}
+	}
+
+	public String getCurrentDateAsText() {
+		Date currentDate = getCurrentDate();
+		if (currentDate != null) {
+			return DateFormat.getDateInstance(DateFormat.FULL).format(
+					currentDate);
+		}
+
+		return null;
+	}
+
+	public Date getCurrentDate() {
+		return currentDate;
+	}
+
+	public void setCurrentDate(Date currentDate) {
+		this.currentDate = currentDate;
+	}
+
+	public Date getSelectedDate() {
+		return selectedDate;
+	}
+
+	public void setSelectedDate(Date selectedDate) {
+		this.selectedDate = selectedDate;
+	}
+
+	public String getJointPoint() {
+		return jointPoint;
+	}
+
+	public void setJointPoint(String jointPoint) {
+		this.jointPoint = jointPoint;
+	}
+
+	public void selectJointPoint(ValueChangeEvent event) {
+		jointPoint = (String) event.getNewValue();
+	}
+
+	public String getDirection() {
+		return direction;
+	}
+
+	public void setDirection(String direction) {
+		this.direction = direction;
+	}
+
+	public void selectDirection(ValueChangeEvent event) {
+		direction = (String) event.getNewValue();
+	}
+
+	public String getBoundary() {
+		return boundary;
+	}
+
+	public void setBoundary(String boundary) {
+		this.boundary = boundary;
+	}
+
+}
\ No newline at end of file




More information about the richfaces-svn-commits mailing list