You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Werner Punz <we...@gmail.com> on 2007/03/08 09:38:34 UTC

i love facelets

I just dropped in a new date control yesterday into a project

<ui:composition>
	<t:dojoInitializer require="dojo.widget.DropdownDatePicker" />
	<t:inputText value="#{entity[fieldName]}" id="#{id}" forceId="true" >
	<s:convertDateTime pattern="dd.MM.yyyy"/>
	</t:inputText>	
	<script type="text/javascript">
		var #{id}_value = dojo.byId("#{id}").value;
		if(!#{id}_value)
		#{id}_value = "";
		dojo.widget.createWidget("DropdownDatePicker",{widgetId:
"#{id}_dojoWidget", inputId: "#{id}", inputName: "#{id}",
dateFormat:"%d.%m.%Y" },dojo.byId('#{id}'));
		dojo.widget.byId("#{id}_dojoWidget").inputNode.value = #{id}_value;
	</script>
</ui:composition>

(the pattern is hardcoded currently)

that is all...

usage:

<ir:dojodatepicker id="fromDate" entity="#{appointmentdetailview}"
fieldName="startDate"/>

I love that stuff...


Re: i love facelets

Posted by Werner Punz <we...@gmail.com>.
Matthias Wessendorf schrieb:
> I just checked the sample of the
> 
> CiviCrmDateTimePicker (in dojo)
> 
> that explains the code ;)
> 
> I don't like that widget, just my 2 cent
> 
Well...
there are more things than you can see...
dojo uses a generic drop down mechanism which you can use to embed
every control on earth, it then drops a specialized implementation of
the  CiviCrmDateTimePicker into this drop down container.

if you do not like the rendering, dojo has its own internal widget
templates which you easily can replace by your own :-)


Re: i love facelets

Posted by Matthias Wessendorf <ma...@apache.org>.
I just checked the sample of the

CiviCrmDateTimePicker (in dojo)

that explains the code ;)

I don't like that widget, just my 2 cent

On 3/8/07, Matthias Wessendorf <ma...@apache.org> wrote:
> can't you combine them ?
> a date/time picker ?
>
> seams odd to me, if no :-)
>
> On 3/8/07, Werner Punz <we...@gmail.com> wrote:
> > Also here is the code for the time picker
> >
> > :-)
> >
> >
> > <ui:composition>
> >         <t:dojoInitializer require="dojo.widget.DropdownTimePicker" />
> >         <t:inputText value="#{entity[fieldName]}" id="#{id}" forceId="true" >
> >                 <s:convertDateTime pattern="HH:mm" />
> >         </t:inputText>
> >         <script type="text/javascript">
> >                 var #{id}_value = dojo.byId("#{id}").value;
> >                 if(!#{id}_value)
> >                 #{id}_value = "";
> >
> > dojo.widget.createWidget("DropdownTimePicker",{widgetId:
> > "#{id}_dojoWidget", inputId: "#{id}", inputName: "#{id}",
> > timeFormat:"%H:%M" },dojo.byId('#{id}'));
> >                                         dojo.widget.byId("#{id}_dojoWidget").inputNode.value = #{id}_value;
> >         </script>
> > </ui:composition>
> >
> >
>
>
> --
> Matthias Wessendorf
> http://tinyurl.com/fmywh
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: i love facelets

Posted by Werner Punz <we...@gmail.com>.
Matthias Wessendorf schrieb:
> can't you combine them ?
> a date/time picker ?
> 

Yes... just add a ui:composition which uses both tags
:-)


Re: i love facelets

Posted by Matthias Wessendorf <ma...@apache.org>.
can't you combine them ?
a date/time picker ?

seams odd to me, if no :-)

On 3/8/07, Werner Punz <we...@gmail.com> wrote:
> Also here is the code for the time picker
>
> :-)
>
>
> <ui:composition>
>         <t:dojoInitializer require="dojo.widget.DropdownTimePicker" />
>         <t:inputText value="#{entity[fieldName]}" id="#{id}" forceId="true" >
>                 <s:convertDateTime pattern="HH:mm" />
>         </t:inputText>
>         <script type="text/javascript">
>                 var #{id}_value = dojo.byId("#{id}").value;
>                 if(!#{id}_value)
>                 #{id}_value = "";
>
> dojo.widget.createWidget("DropdownTimePicker",{widgetId:
> "#{id}_dojoWidget", inputId: "#{id}", inputName: "#{id}",
> timeFormat:"%H:%M" },dojo.byId('#{id}'));
>                                         dojo.widget.byId("#{id}_dojoWidget").inputNode.value = #{id}_value;
>         </script>
> </ui:composition>
>
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: i love facelets

Posted by Werner Punz <we...@gmail.com>.
Also here is the code for the time picker

:-)


<ui:composition>
	<t:dojoInitializer require="dojo.widget.DropdownTimePicker" />	
	<t:inputText value="#{entity[fieldName]}" id="#{id}" forceId="true" >
		<s:convertDateTime pattern="HH:mm" />
	</t:inputText>	
	<script type="text/javascript">
		var #{id}_value = dojo.byId("#{id}").value;
		if(!#{id}_value)
		#{id}_value = "";		

dojo.widget.createWidget("DropdownTimePicker",{widgetId:
"#{id}_dojoWidget", inputId: "#{id}", inputName: "#{id}",
timeFormat:"%H:%M" },dojo.byId('#{id}'));
					dojo.widget.byId("#{id}_dojoWidget").inputNode.value = #{id}_value;
	</script>
</ui:composition>


Re: i love facelets

Posted by Josué Alcalde González <ja...@csa.es>.
El jue, 08-03-2007 a las 10:19 +0100, Werner Punz escribió:
> Josué Alcalde González schrieb:
> > What about: 
> > <t:inputTextHelp value="#{entity[fieldName]}... textHelp="dd.mm.yyyy">
> > 
> problematic, dojo, basically hides the original control
> and replaces it with its own implementation of things...
> so you only can use very basic text or div fields as core for all things
> those are needed however to do the proper parameter passing into
> the request cycle...
> 
Ok, I didn't know.
I am using http://www.dynarch.com/projects/calendar/ which is LGPL.
It is very clean for me but I don't have js and css included
automatically. :( 

It would be great a tag to include a css or a js in <head> and it would
be better if you can take the resource form a jar.

> 
-- 
_______________________________________________
Josué Alcalde González
jalcalde@csa.es
Dpto. Desarrollo

CSA - Centro Regional de Servicios Avanzados
C/ López Bravo, 1
Pol. Ind. Villalonquéjar (Burgos)

Tel. (+34) 947 256 250
Fax. (+34) 947 256 583

Web: http://www.csa.es



Re: i love facelets

Posted by Werner Punz <we...@gmail.com>.
Josué Alcalde González schrieb:
> What about: 
> <t:inputTextHelp value="#{entity[fieldName]}... textHelp="dd.mm.yyyy">
> 
problematic, dojo, basically hides the original control
and replaces it with its own implementation of things...
so you only can use very basic text or div fields as core for all things
those are needed however to do the proper parameter passing into
the request cycle...


Re: i love facelets

Posted by Josué Alcalde González <ja...@csa.es>.
What about: 
<t:inputTextHelp value="#{entity[fieldName]}... textHelp="dd.mm.yyyy">

El jue, 08-03-2007 a las 09:43 +0100, Matthias Wessendorf escribió:
> 
> >         <t:dojoInitializer
> require="dojo.widget.DropdownDatePicker" />
> >         <t:inputText value="#{entity[fieldName]}" id="#{id}"
> forceId="true" >
> >         <s:convertDateTime pattern="dd.MM.yyyy"/>
> >         </t:inputText>
> >         <script type="text/javascript">
> >                 var #{id}_value = dojo.byId("#{id}").value;
> >                 if(!#{id}_value)
> >                 #{id}_value =  
-- 
_______________________________________________
Josué Alcalde González
jalcalde@csa.es
Dpto. Desarrollo

CSA - Centro Regional de Servicios Avanzados
C/ López Bravo, 1
Pol. Ind. Villalonquéjar (Burgos)

Tel. (+34) 947 256 250
Fax. (+34) 947 256 583

Web: http://www.csa.es



Re: i love facelets

Posted by Matthias Wessendorf <ma...@apache.org>.
sweet!

On 3/8/07, Werner Punz <we...@gmail.com> wrote:
> I just dropped in a new date control yesterday into a project
>
> <ui:composition>
>         <t:dojoInitializer require="dojo.widget.DropdownDatePicker" />
>         <t:inputText value="#{entity[fieldName]}" id="#{id}" forceId="true" >
>         <s:convertDateTime pattern="dd.MM.yyyy"/>
>         </t:inputText>
>         <script type="text/javascript">
>                 var #{id}_value = dojo.byId("#{id}").value;
>                 if(!#{id}_value)
>                 #{id}_value = "";
>                 dojo.widget.createWidget("DropdownDatePicker",{widgetId:
> "#{id}_dojoWidget", inputId: "#{id}", inputName: "#{id}",
> dateFormat:"%d.%m.%Y" },dojo.byId('#{id}'));
>                 dojo.widget.byId("#{id}_dojoWidget").inputNode.value = #{id}_value;
>         </script>
> </ui:composition>
>
> (the pattern is hardcoded currently)
>
> that is all...
>
> usage:
>
> <ir:dojodatepicker id="fromDate" entity="#{appointmentdetailview}"
> fieldName="startDate"/>
>
> I love that stuff...
>
>


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com