Attached is a small patch that allows a DatePicker to be sent YUI Calendar
options without having to override the
void configure(Map ) method...

Any feedback welcome.

-- 
Rodolfo Hansen
CEO, KindleIT Software Development
Email: [email protected]
Office: 1 (809) 732-5200
Mobile: 1 (809) 299-7332
### Eclipse Workspace Patch 1.0
#P wicket-datetime
Index: src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
===================================================================
--- src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java	(revision 758453)
+++ src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java	(working copy)
@@ -130,6 +130,8 @@
 	/** The target component. */
 	private Component component;
 
+	private final Map<String, Object> pickerProperties = new HashMap<String, Object>();
+
 	/**
 	 * Construct.
 	 */
@@ -224,7 +226,7 @@
 					"YAHOO.wicket." + widgetId + "DpJs"));
 		}
 		// print out the initialization properties
-		Map<String, Object> p = new HashMap<String, Object>();
+		Map<String, Object> p = new HashMap<String, Object>(pickerProperties);
 		configure(p);
 		if (!p.containsKey("navigator") && enableMonthYearSelection())
 		{
@@ -382,6 +384,21 @@
 	}
 
 	/**
+	 * Set a property for the YUI Calendar.
+	 * 
+	 * @param prop
+	 *            Property to set. See <a href="http://developer.yahoo.com/yui/calendar/";>the
+	 *            widget's documentation</a> for the available options.
+	 * @param val
+	 *            Value to set.
+	 * */
+	public final DatePicker setProperty(String prop, Object val)
+	{
+		pickerProperties.put(prop, val);
+		return this;
+	}
+
+	/**
 	 * @deprecated Please use {...@link #configure(Map)} instead.
 	 */
 	// TODO remove this very ugly named method

Reply via email to