Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Scout/Concepts/DateField"

(page stub)
 
(Added part about differences between DateField and UTCDateField)
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{ScoutPage|cat=Concepts}}
+
{{ScoutPage|cat=Component Model}}  
  
Specific type of {{ScoutLink|Concepts|ValueField|value field}} to represent Date.
+
Specific type of {{ScoutLink|Concepts|ValueField|value field}} to represent Date.  
  
* implements: {{ScoutJavadoc|<TODO:NameOfTheInterface>|I}}
+
*implements: {{ScoutJavadoc|IDateField|I}}  
* extends: {{ScoutJavadoc|<TODO:NameOfTheAbstractClass>|C}}
+
*extends: {{ScoutJavadoc|AbstractDateField|C}}
  
== Description ==
+
== Description ==
Among the different {{ScoutLink|Concepts|Type of Data|types of data supported by scout}}, the DateField is made to represent Date.
+
  
The functions:
+
Among the different {{ScoutLink|Concepts|Type of Data|types of data supported by scout}}, the DateField is made to represent Date.
* setValue(value)
+
* getValue()
+
  
use directly Date.
+
The functions:
  
 +
*setValue(value)
 +
*getValue()
  
== Screenshot ==
+
use directly Date.  
[[Image:Scout_DateField_SWT.png]]
+
  
 +
=== Differences between DateField and UTCDateField  ===
  
== Properties ==
+
On the UI side there is no difference to be seen between a DateField and an UTCDateField (especially, even if the name might imply this, there is no mechanism to manually set a time zone on an UTCDateField). The difference is in how the contained date and time are treated when such a field is accessed in applications in different time zones.  
''Defined with {{ScoutLink|Concepts|GetConfigured Methods|getConfiguredXxxxxx()}} methods''.
+
  
See also the {{ScoutLink|Concepts|Field|Field}} and the {{ScoutLink|Concepts|ValueField|Value field}} pages for the properties that all fields have in common.
+
java.util.Date objects are manipulated by the Scout framework when transferred between client and server: a java.util.Date object is replaced by a static date (org.eclipse.scout.rt.shared.servicetunnel.StaticDate) during serialization. A StaticDate is "time zone and daylight saving time independent", you can think of it similar to a string representation, such as "15:00", which does not change when displayed on other systems. Any information regarding the time zone is lost, a StaticDate is always implicitly interpreted in the systems' current time zone. Or in other words: A date is always displayed exactly the way as it would be on the system that created it!
  
 +
UTCDate objects are not treated in any specific way by the Scout framework. They represent a given point in time, encoded as the offset in milliseconds to the 'epoch' January 1, 1970, 0:00:00 UTC. So they behave just as you would expect of normal java.util.Date objects. If the same date is displayed on two systems in different time zones, you will have two different representations.
  
== Events ==
+
Example (Note: when talking about 'dates', we're actually talking about its time part here. It's the time part that matters in this context.)
''Defined with {{ScoutLink|Concepts|Exec_Methods|execXxxxxx()}} methods''.
+
  
See also the {{ScoutLink|Concepts|Field|Field}} and the {{ScoutLink|Concepts|ValueField|Value field}} pages for the events that all fields have in common.
+
'''Date'''
 +
<pre>Server UTC+0            Client1 UTC+1            Client2 UTC+2
 +
--------------------------------------------------------------
 +
d = new Date()
 +
                      "15:00" UTC+1
 +
            &lt;-- "15:00" --
  
 +
"15:00" UTC+0
  
== See Also ==
+
            --------------- "15:00" -------------&gt;
* {{ScoutLink|Concepts|ValueField|Value field}}
+
                                                "15:00" UTC+2
* {{ScoutLink|Concepts|Field|Field}}
+
</pre>
* {{ScoutLink|Concepts|Form|Form}}
+
'''UTCDate'''
* The corresponding column: {{ScoutLink|Concepts|DateColumn|DateColumn}}
+
<pre>Server UTC+0            Client1 UTC+1            Client2 UTC+2
* {{ScoutLink|Concepts|Type of Data|Type of data supported by Scout in the fields}}
+
--------------------------------------------------------------
 +
d = new UTCDate()
 +
                      "15:00" UTC+1
 +
          &lt;----- d -----
 +
"14:00" UTC+0
 +
          ----------------- d ---------------&gt;
 +
                                                "16:00" UTC+2
 +
</pre>
 +
<br>
 +
 
 +
{{Note|Problematic behaviour|The current default behavior for java.util.Date is problematic in many cases where systems in different time zones are involved, a discussion on how this could be resolved in Scout is being held in [http://www.eclipse.org/forums/index.php/mv/msg/449566/1004813/#msg_1004813 this forum thread]}}
 +
 +
 
 +
== Screenshot  ==
 +
 
 +
{|
 +
|-
 +
! RAP
 +
! SWT
 +
! Swing
 +
! Swing Rayo
 +
|-
 +
| [[Image:Scout 3.8 DateField RAP.png]]
 +
| [[Image:Scout 3.8 DateField SWT.png]]
 +
| [[Image:Scout 3.8 DateField Swing.png]]
 +
| [[Image:Scout 3.8 DateField Swing Rayo.png]]
 +
|}
 +
 
 +
== Properties  ==
 +
 
 +
''Defined with {{ScoutLink|Concepts|GetConfigured Methods|getConfiguredXxxxxx()}} methods''.
 +
 
 +
See also the {{ScoutLink|Concepts|Field|Field}} and the {{ScoutLink|Concepts|ValueField|Value field}} pages for the properties that all fields have in common.
 +
 
 +
<br>
 +
 
 +
== Events  ==
 +
 
 +
''Defined with {{ScoutLink|Concepts|Exec_Methods|execXxxxxx()}} methods''.
 +
 
 +
See also the {{ScoutLink|Concepts|Field|Field}} and the {{ScoutLink|Concepts|ValueField|Value field}} pages for the events that all fields have in common.
 +
 
 +
<br>
 +
 
 +
== See Also ==
 +
 
 +
*{{ScoutLink|Concepts|ValueField|Value field}}  
 +
*{{ScoutLink|Concepts|Field|Field}}  
 +
*{{ScoutLink|Concepts|Form|Form}}  
 +
*The corresponding column: {{ScoutLink|Concepts|DateColumn|DateColumn}}  
 +
*{{ScoutLink|Concepts|Type of Data|Type of data supported by Scout in the fields}}

Revision as of 03:16, 7 March 2013

The Scout documentation has been moved to https://eclipsescout.github.io/.

Specific type of The Scout documentation has been moved to https://eclipsescout.github.io/. to represent Date.

Description

Among the different The Scout documentation has been moved to https://eclipsescout.github.io/., the DateField is made to represent Date.

The functions:

  • setValue(value)
  • getValue()

use directly Date.

Differences between DateField and UTCDateField

On the UI side there is no difference to be seen between a DateField and an UTCDateField (especially, even if the name might imply this, there is no mechanism to manually set a time zone on an UTCDateField). The difference is in how the contained date and time are treated when such a field is accessed in applications in different time zones.

java.util.Date objects are manipulated by the Scout framework when transferred between client and server: a java.util.Date object is replaced by a static date (org.eclipse.scout.rt.shared.servicetunnel.StaticDate) during serialization. A StaticDate is "time zone and daylight saving time independent", you can think of it similar to a string representation, such as "15:00", which does not change when displayed on other systems. Any information regarding the time zone is lost, a StaticDate is always implicitly interpreted in the systems' current time zone. Or in other words: A date is always displayed exactly the way as it would be on the system that created it!

UTCDate objects are not treated in any specific way by the Scout framework. They represent a given point in time, encoded as the offset in milliseconds to the 'epoch' January 1, 1970, 0:00:00 UTC. So they behave just as you would expect of normal java.util.Date objects. If the same date is displayed on two systems in different time zones, you will have two different representations.

Example (Note: when talking about 'dates', we're actually talking about its time part here. It's the time part that matters in this context.)

Date

Server UTC+0            Client1 UTC+1            Client2 UTC+2
--------------------------------------------------------------
d = new Date()
                       "15:00" UTC+1
            <-- "15:00" --

"15:00" UTC+0

            --------------- "15:00" ------------->
                                                "15:00" UTC+2

UTCDate

Server UTC+0            Client1 UTC+1            Client2 UTC+2
--------------------------------------------------------------
d = new UTCDate()
                       "15:00" UTC+1
           <----- d -----
"14:00" UTC+0
           ----------------- d --------------->
                                                "16:00" UTC+2


Note.png
Problematic behaviour
The current default behavior for java.util.Date is problematic in many cases where systems in different time zones are involved, a discussion on how this could be resolved in Scout is being held in this forum thread


Screenshot

RAP SWT Swing Swing Rayo
Scout 3.8 DateField RAP.png Scout 3.8 DateField SWT.png Scout 3.8 DateField Swing.png Scout 3.8 DateField Swing Rayo.png

Properties

Defined with The Scout documentation has been moved to https://eclipsescout.github.io/. methods.

See also the The Scout documentation has been moved to https://eclipsescout.github.io/. and the The Scout documentation has been moved to https://eclipsescout.github.io/. pages for the properties that all fields have in common.


Events

Defined with The Scout documentation has been moved to https://eclipsescout.github.io/. methods.

See also the The Scout documentation has been moved to https://eclipsescout.github.io/. and the The Scout documentation has been moved to https://eclipsescout.github.io/. pages for the events that all fields have in common.


See Also

Back to the top