0

Using Datebox with time

asked 2007-01-17 09:46:12 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4107172

By: kkurt

I want to use datebox with time, how can i do ? Thanks..

delete flag offensive retag edit

15 Replies

Sort by ยป oldest newest

answered 2007-01-18 03:55:32 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4108930

By: henrichen

Currently there is no "time" part for datebox. Please post to our Feature Request.
And we need a proper UI design for this time component. Any reference?

/henri

link publish delete flag offensive edit

answered 2007-01-18 08:58:55 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4109158

By: taffit_

Just as reference:
The dojo toolkit has a timepicker, can be seen in action at http://dojotoolkit.org/ under See it in action -> Form Widgets -> CiviCrmDateTimePicker or Timepicker.
Other examples:
http://www.rainforestnet.com/datetimepicker.htm
As applet and also with intervalls:
http://java.arcadevillage.com/applets/timepica.htm
http://www.java2s.com/Code/JavaScript/GUI-Components/FancyTimePicker.htm
http://www.softcomplex.com/products/tigra_calendar/demo1.html

Just some inspiration ;-)

taffit


link publish delete flag offensive edit

answered 2007-01-18 13:23:55 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4109499

By: henrichen

Thanks for the info.

/henri

link publish delete flag offensive edit

answered 2007-01-25 20:10:13 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4122513

By: siriusjava

I believe there already is a feature request to add a time to the calendar widget.

link publish delete flag offensive edit

answered 2009-02-03 22:57:21 +0800

abrar gravatar image abrar
27

Has this feature been implemented yet? We are currently reviewing RIA frameworks and Time picking widgets is one of our requirement.

link publish delete flag offensive edit

answered 2009-02-04 00:52:09 +0800

jj gravatar image jj
638 3

Looks like it is in since version 3.0.
Look at ZUL JavaDoc: Timebox, Only tracks hour and minutes.

link publish delete flag offensive edit

answered 2009-02-10 15:46:58 +0800

bob007 gravatar image bob007
384 3 4

Hi JJ,

I need to use this feature too. Where did u see we can use a datebox with time (not a Datebox and a Timebox) ? I can't find it anywhere.

I need this because i want to data bind the date and the time with the same class attribute. Or else how can i do it ?

Thanks,
Steve

link publish delete flag offensive edit

answered 2009-02-11 00:26:55 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

Steve,

There is no Datebox with time part in ZK yet. You have to use Datebox + Timebox solution. As for "bind the date and the time with the same class attribute.", you can write TypeConverter to 'extract' only the required part so they are combined automatically.

link publish delete flag offensive edit

answered 2009-02-11 15:49:12 +0800

bob007 gravatar image bob007
384 3 4

updated 2009-02-11 16:19:37 +0800

Hi Henri,

I tried your solution, it seem a great idea, but i think it can't work.

DateTimeConverter.java

import java.util.Date;
import org.zkoss.zkplus.databind.TypeConverter;
import org.zkoss.zul.Timebox;


public class DateTimeConverter implements TypeConverter {
   
   public Object coerceToBean(java.lang.Object val, org.zkoss.zk.ui.Component comp) {
      Date date = (Date) val;
      Date newDate = ((Timebox) comp).getValue();

      //just to see the value of val and comp
      System.out.println("val :" + date);
      System.out.println("comp val :" + newDate);

      /*
      date.setHours(newDate.getHours());
      date.setMinutes(newDate.getMinutes());
      return date;
      */
      
      return null;
   }
      
   public Object coerceToUi(java.lang.Object val, org.zkoss.zk.ui.Component comp) {
      return val;   
   }
}


<datebox value="@{person.birth}" />
<timebox value="@{person.birth, converter='DateTimeConverter'}" />


the printed value are :
val :Thu Jan 01 11:26:00 EST 1970
comp val :Thu Jan 01 11:26:00 EST 1970


So neither contain the previous value of the datebox (it was the current date), so then how can i combine the values of the Datebox and the Timebox ?

Thanks
Steve

link publish delete flag offensive edit

answered 2009-02-12 00:27:34 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

Steve,

You are right. No way to get the original bean value in TypeConverter :(.

There is no direct way as what I can think then. You might need a transient variable to hold the <timebox>
value and then combine them later in onChange event listener of <timebox>.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-01-17 09:46:12 +0800

Seen: 1,595 times

Last updated: Feb 13 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More