You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2007/12/11 12:33:44 UTC

svn commit: r603213 - in /myfaces/tomahawk/trunk/core/src/main: java/org/apache/myfaces/custom/calendar/HtmlInputCalendar.java java/org/apache/myfaces/custom/calendar/HtmlInputCalendarTag.java tld/tomahawk-entities/tomahawk_input_calendar_attributes.xml

Author: skitching
Date: Tue Dec 11 03:33:37 2007
New Revision: 603213

URL: http://svn.apache.org/viewvc?rev=603213&view=rev
Log:
Support t:inputCalendar selectMode property as an explicit tag attribute

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendar.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendarTag.java
    myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_input_calendar_attributes.xml

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendar.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendar.java?rev=603213&r1=603212&r2=603213&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendar.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendar.java Tue Dec 11 03:33:37 2007
@@ -65,6 +65,7 @@
     private String _popupTheme = null;
     private String _popupButtonImageUrl = null;
     private String _helpText = null;
+    private String _selectMode = null;
 
     public HtmlInputCalendar()
     {
@@ -473,10 +474,13 @@
     		return "none";
     	}
     	
-    	Object mode = getAttributes().get("selectionMode");
-    	if (mode == null)
-    		return "day";
-    	else
-    		return mode.toString();
+        if (_selectMode != null) return _selectMode;
+        ValueBinding vb = getValueBinding("selectMode");
+        return vb != null ? _ComponentUtils.getStringValue(getFacesContext(), vb) : "day";
+    }
+
+    public void setSelectMode(String selectMode)
+    {
+        _selectMode = selectMode;
     }
 }

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendarTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendarTag.java?rev=603213&r1=603212&r2=603213&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendarTag.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlInputCalendarTag.java Tue Dec 11 03:33:37 2007
@@ -85,6 +85,7 @@
     private String _popupTheme = null;
     private String _popupButtonImageUrl = null;
     private String _helpText;
+    private String _selectMode;
 
     // User Role support
     private String _enabledOnUserRole;
@@ -119,6 +120,7 @@
         _popupTheme=null;
         _popupButtonImageUrl=null;
         _helpText = null;
+        _selectMode = null;
     }
 
 
@@ -157,6 +159,7 @@
         setStringProperty(component,"popupTheme",_popupTheme);
         setStringProperty(component,"popupButtonImageUrl",_popupButtonImageUrl);
         setStringProperty(component,"helpText",_helpText);
+        setStringProperty(component,"selectMode",_selectMode);
 
         setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
         setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
@@ -291,6 +294,11 @@
     public void setHelpText(String helpText)
     {
         _helpText = helpText;
+    }
+
+    public void setSelectMode(String selectMode)
+    {
+    	_selectMode = selectMode;
     }
 
     public void setAccesskey(String accesskey)

Modified: myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_input_calendar_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_input_calendar_attributes.xml?rev=603213&r1=603212&r2=603213&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_input_calendar_attributes.xml (original)
+++ myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_input_calendar_attributes.xml Tue Dec 11 03:33:37 2007
@@ -180,4 +180,21 @@
             <rtexprvalue>false</rtexprvalue>
             <description>The text that will be rendered in the field - helping the user to find the right format to enter into the field.</description>
         </attribute>
+        <attribute>
+            <name>selectMode</name>
+            <required>false</required>
+            <rtexprvalue>false</rtexprvalue>
+            <description><![CDATA[
+            <p>
+              May be "day", "week", "month" or "none":
+              <ul>
+              <li>day (default): allow the user to select a day.</li>
+              <li>week: only allow the user to select a week.</li>
+              <li>month: only allow the user to select a month.</li> 
+              <li>none: equivalent to "readonly".</li> 
+              </ul>
+            </p>
+              ]]>
+            </description>
+        </attribute>