Revision: 4475
          http://vexi.svn.sourceforge.net/vexi/?rev=4475&view=rev
Author:   mkpg2
Date:     2013-01-13 00:26:16 +0000 (Sun, 13 Jan 2013)
Log Message:
-----------
Datetime widget. Support vexi.js.Instant.

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datetime.t

Added Paths:
-----------
    trunk/org.vexi-vexi.widgets/src_poke/poke/widgets/datetime.t

Removed Paths:
-------------
    trunk/org.vexi-vexi.widgets/src_poke/visualtest/datetime.t

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datetime.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datetime.t      
2013-01-13 00:21:47 UTC (rev 4474)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datetime.t      
2013-01-13 00:26:16 UTC (rev 4475)
@@ -13,6 +13,8 @@
         thisbox.v_timefield = $time;
         thisbox.v_textbox = false;
         
+        thisbox.valuetype;
+        
         thisbox.date ++= function(v) {
             $date.value = v;
             $time.value = v;
@@ -40,6 +42,8 @@
             if (v == storeval) return;
                 
             switch (typeof(v)) {
+            case "vexi.js.Instant":
+                v = ""+v;
             case "string":
                 var vlc = v.toLowerCase();
                 if (vlc=="today" or vlc=="now") {
@@ -76,19 +80,18 @@
         thisbox.value ++= function() {
             var d = $date.value;
             var t = $time.value;
-            if (d==null and t==null) {
+            if (d==null || t==null) {
                 storeval = null;
                 return null;
             }
-            if (t==null) {
-                storeval = d;
-                return d;
+            
+            var r = d+' '+t;
+            if(valuetype=="vexi.js.Instant"){
+                r = vexi.js.Instant.tryParseTimestamp(r);
+                if(r==null) throw d+' '+t;                
             }
-            if (d==null) {
-                storeval = t;
-                return t;
-            }
-            storeval = d+' '+t;
+            
+            storeval = r;
             return storeval;
         }
         

Copied: trunk/org.vexi-vexi.widgets/src_poke/poke/widgets/datetime.t (from rev 
4461, trunk/org.vexi-vexi.widgets/src_poke/visualtest/datetime.t)
===================================================================
--- trunk/org.vexi-vexi.widgets/src_poke/poke/widgets/datetime.t                
                (rev 0)
+++ trunk/org.vexi-vexi.widgets/src_poke/poke/widgets/datetime.t        
2013-01-13 00:26:16 UTC (rev 4475)
@@ -0,0 +1,40 @@
+<vexi xmlns:ui="vexi://ui" xmlns:w="vexi.widget">
+    <w:surface />
+    <ui:box orient="vertical">
+        <w:timefield id="time"/>
+        <w:datefield id="date"/>
+        <w:datetime id="datetime"/>
+        <w:monthfield />
+        <w:yearfield />
+        <ui:box>
+            <w:button id="enable" text="Enable/Disable" />
+            <w:button id="clear" text="Clear" />
+            <vexi.theme.datefield />
+        </ui:box>
+        
+        $enable.action ++= function(v) {
+            var e = !$time.enabled;
+            for (var i,b in thisbox)
+                b.enabled = e;
+        }
+        
+        $clear.action ++= function(v) {
+            for (var i,b in thisbox)
+                b.value = null;
+        }
+        
+        var printValueTrap = function(v){
+            cascade = v;
+            vexi.trace(v);
+        };
+        
+        $date.valuetype = "vexi.util.date";
+        $time.value ++= printValueTrap;
+        $date.value ++= printValueTrap;
+        $datetime.valuetype = "vexi.js.Instant";
+        $datetime.value ++= printValueTrap;
+        
+        vexi.ui.frame = thisbox;
+        
+    </ui:box>
+</vexi>
\ No newline at end of file

Deleted: trunk/org.vexi-vexi.widgets/src_poke/visualtest/datetime.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_poke/visualtest/datetime.t  2013-01-13 
00:21:47 UTC (rev 4474)
+++ trunk/org.vexi-vexi.widgets/src_poke/visualtest/datetime.t  2013-01-13 
00:26:16 UTC (rev 4475)
@@ -1,39 +0,0 @@
-<vexi xmlns:ui="vexi://ui" xmlns:w="vexi.widget">
-    <w:surface />
-    <ui:box orient="vertical">
-        <w:timefield id="time"/>
-        <w:datefield id="date"/>
-        <w:datetime id="datetime"/>
-        <w:monthfield />
-        <w:yearfield />
-        <ui:box>
-            <w:button id="enable" text="Enable/Disable" />
-            <w:button id="clear" text="Clear" />
-            <vexi.theme.datefield />
-        </ui:box>
-        
-        $enable.action ++= function(v) {
-            var e = !$time.enabled;
-            for (var i,b in thisbox)
-                b.enabled = e;
-        }
-        
-        $clear.action ++= function(v) {
-            for (var i,b in thisbox)
-                b.value = null;
-        }
-        
-        var printValueTrap = function(v){
-            cascade = v;
-            vexi.trace(v);
-        };
-        
-        $date.valuetype = "vexi.util.date";
-        $time.value ++= printValueTrap;
-        $date.value ++= printValueTrap;
-        $datetime.value ++= printValueTrap;
-        
-        vexi.ui.frame = thisbox;
-        
-    </ui:box>
-</vexi>
\ No newline at end of file

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to