You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jo...@smartonline.com on 2010/06/18 20:28:35 UTC

Strust timepicker

The current  Struts dojo timepicker closes when the User selects any time component. Is there a way for the component to remain open until the User has selected hour, minute and AM/PM


Regards,

[http://www.smartonline.com/] John Varghese

Note: The information contained in this email is privileged and confidential information intended for the use of the addressee. If the reader of this email is not the intended recipient, or the employee or agent thereof, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you received this email in error, please immediately notify the sender listed above and destroy this message

RE: Struts timepicker

Posted by Martin Gainty <mg...@hotmail.com>.
//in your html/jsp

//notice this association of hourContainerNode to onSetSelectedHour event which needs to be disconnected so the onSetSelectedHour event does not fire
      <tbody dojoAttachPoint="hourContainerNode"  -->
<!--       dojoAttachEvent="onClick: onSetSelectedHour;"                                          comment this out to prevent event firing -->


//in your html/jsp

//then change the bolded text found in this definition for isContainer

<tbody dojoAttachPoint="minuteContainerNode" />
<!--       dojoAttachEvent="onClick: onSetSelectedMinute;" -->

 

//notice this association of minuteContainerNode to onSetSelectedMinute event which needs to be disconnected to the event so the onSetSelectedMinute event does not fire

//i would suggest making a backup copy of .\plugins\dojo\src\main\resources\org\apache\struts2\static\dojo\struts_dojo.js

//be careful as to retain brackets,commas and anything else you may see


{isContainer:false,templateString:"<div class=\"timePickerContainer\" dojoAttachPoint=\"timePickerContainerNode\">\r\n\t

<table class=\"timeContainer\" cellspacing=\"0\" >\r\n\t\t

<thead>\r\n\t\t\t

<tr>\r\n\t\t\t\t

<td class=\"timeCorner cornerTopLeft\" valign=\"top\">&nbsp;</td>\r\n\t\t\t\t

<td class=\"timeLabelContainer hourSelector\">${this.calendar.field-hour}</td>\r\n\t\t\t\t

<td class=\"timeLabelContainer minutesHeading\">${this.calendar.field-minute}</td>\r\n\t\t\t\t

<td class=\"timeCorner cornerTopRight\" valign=\"top\">&nbsp;</td>\r\n\t\t\t

</tr>\r\n\t\t

</thead>\r\n\t\t

<tbody>\r\n\t\t\t

<tr>\r\n\t\t\t\t

<td valign=\"top\" colspan=\"2\" class=\"hours\">\r\n\t\t\t\t\t

<table align=\"center\">\r\n\t\t\t\t\t\t

 

<tbody dojoAttachPoint=\"hourContainerNode\"  \r\n\t\t\t\t\t\t\t -->

<!-- comment out the onSetSelectedHour -->

<!-- dojoAttachEvent=\"onClick:onSetSelectedHour;\" -->

 

\r\n\t\t\t\t\t\t\t

<tr>\r\n\t\t\t\t\t\t\t\t

<td>12</td>\r\n\t\t\t\t\t\t\t\t<td>6</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td>1</td>\r\n\t\t\t\t\t\t\t\t<td>7</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td>2</td>\r\n\t\t\t\t\t\t\t\t<td>8</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td>3</td>\r\n\t\t\t\t\t\t\t\t<td>9</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td>4</td>\r\n\t\t\t\t\t\t\t\t<td>10</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td>5</td>\r\n\t\t\t\t\t\t\t\t<td>11</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td valign=\"top\" class=\"minutes\" colspan=\"2\">\r\n\t\t\t\t\t

<table align=\"center\">\r\n\t\t\t\t\t\t

 

<tbody dojoAttachPoint=\"minuteContainerNode\" \r\n\t\t\t\t\t\t\t -->

<!-- comment this out and wait for AM/PM to be selected -->

<!-- dojoAttachEvent=\"onClick:onSetSelectedMinute;\" --> 

 

\r\n\t\t\t\t\t\t\t

<tr>\r\n\t\t\t\t\t\t\t\t

<td>00</td>\r\n\t\t\t\t\t\t\t\t

<td>30</td>\r\n\t\t\t\t\t\t\t

</tr>\r\n\t\t\t\t\t\t\t

<tr>\r\n\t\t\t\t\t\t\t\t

<td>05</td>\r\n\t\t\t\t\t\t\t\t

<td>35</td>\r\n\t\t\t\t\t\t\t

</tr>\r\n\t\t\t\t\t\t\t

<tr>\r\n\t\t\t\t\t\t\t\t

<td>10</td>\r\n\t\t\t\t\t\t\t\t

<td>40</td>\r\n\t\t\t\t\t\t\t

</tr>\r\n\t\t\t\t\t\t\t

<tr>\r\n\t\t\t\t\t\t\t\t

<td>15</td>\r\n\t\t\t\t\t\t\t\t

<td>45</td>\r\n\t\t\t\t\t\t\t

</tr>\r\n\t\t\t\t\t\t\t

<tr>\r\n\t\t\t\t\t\t\t\t

<td>20</td>\r\n\t\t\t\t\t\t\t\t

<td>50</td>\r\n\t\t\t\t\t\t\t

</tr>\r\n\t\t\t\t\t\t\t

<tr>\r\n\t\t\t\t\t\t\t\t

<td>25</td>\r\n\t\t\t\t\t\t\t\t

<td>55</td>\r\n\t\t\t\t\t\t\t

</tr>\r\n\t\t\t\t\t\t

</tbody>\r\n\t\t\t\t\t

</table>\r\n\t\t\t\t

</td>\r\n\t\t\t

</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t

<td class=\"cornerBottomLeft\">&nbsp;

</td>\r\n\t\t\t\t

<td valign=\"top\" class=\"timeOptions\">\r\n\t\t\t\t\t

<table class=\"amPmContainer\">\r\n\t\t\t\t\t\t

 

<!-- inside the onSelectedAmPm javascript function you want to do a call to onSetSelectedHour() and onSelectedMinute() functions -->

<tbody dojoAttachPoint=\"amPmContainerNode\" \r\n\t\t\t\t\t\t\tdojoAttachEvent=\"onClick: onSetSelectedAmPm;\">

 

\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td id=\"am\">${this.calendar.am}</td>\r\n\t\t\t\t\t\t\t\t<td id=\"pm\">${this.calendar.pm}</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td class=\"timeOptions\">\r\n\t\t\t\t\t<div dojoAttachPoint=\"anyTimeContainerNode\" \r\n\t\t\t\t\t\tdojoAttachEvent=\"onClick: onSetSelectedAnyTime;\" \r\n\t\t\t\t\t\tclass=\"anyTimeContainer\">${this.widgetStrings.any}</div>\r\n\t\t\t\t</td>\r\n\t\t\t\t<td class=\"cornerBottomRight\">&nbsp;</td>\r\n\t\t\t</tr>\r\n\t\t</tbody>\r\n\t</table>\r\n</div>\r\n",templateCssString:"/*Time Picker */\r\n.timePickerContainer {\r\n\twidth:122px;\r\n\tfont-family:Tahoma, Myriad, Helvetica, Arial, Verdana, sans-serif;\r\n\tfont-size:16px;\r\n}\r\n\r\n.timeContainer {\r\n\tborder-collapse:collapse;\r\n\tborder-spacing:0;\r\n}\r\n\r\n.timeContainer thead {\r\n\tcolor:#293a4b;\r\n\tfont-size:0.9em;\r\n\tfont-weight:700;\r\n}\r\n\r\n.timeContainer thead td {\r\n\tpadding:0.25em;\r\n\tfont-size:0.80em;\r\n\tborder-bottom:1px solid #6782A8;\r\n}\r\n\r\n.timeCorner {\r\n\twidth:10px;\r\n}\r\n\r\n.cornerTopLeft {\r\n\tbackground: url(\"images/dpCurveTL.png\") top left no-repeat;\r\n}\r\n\r\n.cornerTopRight {\r\n\tbackground: url(\"images/dpCurveTR.png\") top right no-repeat;\r\n}\r\n\r\n.timeLabelContainer {\r\n\tbackground: url(\"images/dpMonthBg.png\") top left repeat-x;\r\n}\r\n\r\n.hours, .minutes, .timeBorder {\r\n\tbackground: #7591bc url(\"images/dpBg.gif\") top left repeat-x;\r\n\r\n}\r\n\r\n.hours td, .minutes td {\r\n\tpadding:0.2em;\r\n\ttext-align:center;\r\n\tfont-size:0.7em;\r\n\tfont-weight:bold;\r\n\tcursor:pointer;\r\n\tcursor:hand;\r\n\tcolor:#fff;\r\n}\r\n\r\n.minutes {\r\n\tborder-left:1px solid #f5d1db;\r\n}\r\n\r\n.hours {\r\n\tborder-right:1px solid #6782A8;\r\n}\r\n\r\n.hourSelector {\r\n\tborder-right:1px solid #6782A8;\r\n\tpadding:5px;\r\n\tpadding-right:10px;\r\n}\r\n\r\n.minutesSelector {\r\n\tpadding:5px;\r\n\tborder-left:1px solid #f5c7d4;\r\n\ttext-align:center;\r\n}\r\n\r\n.minutesHeading {\r\n\tpadding-left:9px !important;\r\n}\r\n\r\n.timeOptions {\r\n\tbackground-color:#F9C9D7;\r\n}\r\n\r\n.timeContainer .cornerBottomLeft, .timeContainer .cornerBottomRight, .timeContainer .timeOptions {\r\n\tborder-top:1px solid #6782A8;\r\n}\r\n\r\n.timeContainer .cornerBottomLeft {\r\n\tbackground: url(\"images/dpCurveBL.png\") bottom left no-repeat !important;\r\n\twidth:9px !important;\r\n\tpadding:0;\r\n\tmargin:0;\r\n}\r\n\r\n.timeContainer .cornerBottomRight {\r\n\tbackground: url(\"images/dpCurveBR.png\") bottom right no-repeat !important;\r\n\twidth:9px !important;\r\n\tpadding:0;\r\n\tmargin:0;\r\n}\r\n\r\n.timeOptions {\r\n\tcolor:#fff;\r\n\tbackground:url(\"images/dpYearBg.png\") top left repeat-x;\r\n\r\n}\r\n\r\n.selectedItem {\r\n\tbackground-color:#fff;\r\n\tcolor:#6782a8 !important;\r\n}\r\n\r\n.timeOptions .selectedItem {\r\n\tcolor:#fff !important;\r\n\tbackground-color:#9ec3fb !important;\r\n}\r\n\r\n.anyTimeContainer {\r\n\ttext-align:center;\r\n\tfont-weight:bold;\r\n\tfont-size:0.7em;\r\n\tpadding:0.1em;\r\n\tcursor:pointer;\r\n\tcursor:hand;\r\n\tcolor:#fff !important;\r\n}\r\n\r\n.amPmContainer {\r\n\twidth:100%;\r\n}\r\n\r\n.amPmContainer td {\r\n\ttext-align:center;\r\n\tfont-size:0.7em;\r\n\tfont-weight:bold;\r\n\tcursor:pointer;\r\n\tcursor:hand;\r\n\tcolor:#fff;\r\n}\r\n\r\n\r\n\r\n/*.timePickerContainer {\r\n\tmargin:1.75em 0 0.5em 0;\r\n\twidth:10em;\r\n\tfloat:left;\r\n}\r\n\r\n.timeContainer {\r\n\tborder-collapse:collapse;\r\n\tborder-spacing:0;\r\n}\r\n\r\n.timeContainer thead td{\r\n\tborder-bottom:1px solid #e6e6e6;\r\n\tpadding:0 0.4em 0.2em 0.4em;\r\n}\r\n\r\n.timeContainer td {\r\n\tfont-size:0.9em;\r\n\tpadding:0 0.25em 0 0.25em;\r\n\ttext-align:left;\r\n\tcursor:pointer;cursor:hand;\r\n}\r\n\r\n.timeContainer td.minutesHeading {\r\n\tborder-left:1px solid #e6e6e6;\r\n\tborder-right:1px solid #e6e6e6;\t\r\n}\r\n\r\n.timeContainer .minutes {\r\n\tborder-left:1px solid #e6e6e6;\r\n\tborder-right:1px solid #e6e6e6;\r\n}\r\n\r\n.selectedItem {\r\n\tbackground-color:#3a3a3a;\r\n\tcolor:#ffffff;\r\n}*/\r\n",templateCssPath:dojo.uri.moduleUri("dojo.widget","templates/TimePicker.css"),postMixInProperties:function(_dba,frag){


//later on in struts_dojo.js change the onSetSelectedAmPm to accept onSetSelectedHour and onSetSelectedMinute

onSetSelectedAmPm:function(evt){
this.onClearSelectedAnyTime();

 

//add this  in

onSetSelectedHour();

onSetSelectedMinute();


this.onClearSelectedAmPm();
this.setSelectedAmPm(evt);
this.selectedTime.anyTime=false;
this.onSetTime();
}


BTW: all of this comes straight from dojo so ..(so dont blame struts for any inconsistent or incorrect behaviour in dojo base functionality)

 

HTH

Martin
____________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> Date: Mon, 21 Jun 2010 08:27:36 -0400
> Subject: RE: Struts timepicker
> From: john.varghese@smartonline.com
> To: john.varghese@smartonline.com
> CC: user@struts.apache.org
> 
> Good morning friends....Is there a way to achieve the below mentioned functionality?
> 
> -----Original Message-----
> From: john.varghese@smartonline.com
> Sent: Friday, June 18, 2010 2:28pm
> To: user@struts.apache.org
> Subject: Strust timepicker
> 
> 
> The current Struts dojo timepicker closes when the User selects any time component. Is there a way for the component to remain open until the User has selected hour, minute and AM/PM
> 
> 
> Regards,
> 
> [http://www.smartonline.com/] John Varghese
> 
> Note: The information contained in this email is privileged and confidential information intended for the use of the addressee. If the reader of this email is not the intended recipient, or the employee or agent thereof, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you received this email in error, please immediately notify the sender listed above and destroy this message
 		 	   		  
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

RE: Struts timepicker

Posted by jo...@smartonline.com.
Good morning friends....Is  there a way to achieve the below mentioned functionality?

-----Original Message-----
From: john.varghese@smartonline.com
Sent: Friday, June 18, 2010 2:28pm
To: user@struts.apache.org
Subject: Strust timepicker


The current  Struts dojo timepicker closes when the User selects any time component. Is there a way for the component to remain open until the User has selected hour, minute and AM/PM


Regards,

[http://www.smartonline.com/] John Varghese

Note: The information contained in this email is privileged and confidential information intended for the use of the addressee. If the reader of this email is not the intended recipient, or the employee or agent thereof, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you received this email in error, please immediately notify the sender listed above and destroy this message