Author: hlship
Date: Wed Sep 10 11:27:43 2008
New Revision: 693919
URL: http://svn.apache.org/viewvc?rev=693919&view=rev
Log:
TAPESTRY-2576: The text field for a DateField component should be optional
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DateFieldDemo.tml
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java?rev=693919&r1=693918&r2=693919&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/DateField.java
Wed Sep 10 11:27:43 2008
@@ -72,6 +72,13 @@
private DateFormat format;
/**
+ * If true, then the text field will be hidden, and only the icon for the
date picker will be visible. The default
+ * is false.
+ */
+ @Parameter
+ private boolean hideTextField;
+
+ /**
* The object that will perform input validation (which occurs after
translation). The translate binding prefix is
* generally used to provide this object in a declarative fashion.
*/
@@ -200,7 +207,7 @@
writer.element(INPUT_PARAMETER,
- "type", "text",
+ "type", hideTextField ? "hidden" : "text",
"name", getControlName(),
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js?rev=693919&r1=693918&r2=693919&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
Wed Sep 10 11:27:43 2008
@@ -161,7 +161,12 @@
positionPopup : function()
{
- this.popup.clonePosition(this.field, { offsetTop:
this.field.getHeight() + 2 }).setStyle({ width: "", height: "" });
+ // The field may be a hidden field, in which csae, position the popup
based on the trigger, not
+ // the hidden.
+
+ var reference = this.field.type == "text" ? this.field : this.trigger;
+
+ this.popup.clonePosition(reference, { offsetTop: reference.getHeight()
+ 2 }).setStyle({ width: "", height: "" });
},
/** Duration, in seconds, used when fading the popup in or out. */
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DateFieldDemo.tml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DateFieldDemo.tml?rev=693919&r1=693918&r2=693919&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DateFieldDemo.tml
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DateFieldDemo.tml Wed
Sep 10 11:27:43 2008
@@ -10,7 +10,7 @@
<div class="t-beaneditor-row">
<t:label for="birthday"/>
- <t:datefield format="d MMM yyyy" t:id="birthday"/>
+ <t:datefield format="d MMM yyyy" hidetextfield="true"
t:id="birthday"/>
</div>
<div class="t-beaneditor-row">