Revision: 4780
http://sourceforge.net/p/vexi/code/4780
Author: mkpg2
Date: 2015-04-04 20:40:20 +0000 (Sat, 04 Apr 2015)
Log Message:
-----------
Reinstate date format support.
Modified Paths:
--------------
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datefield.t
Added Paths:
-----------
branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/widgets/datefield_format.t
Modified:
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datefield.t
===================================================================
---
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datefield.t
2015-04-01 17:11:00 UTC (rev 4779)
+++
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/datefield.t
2015-04-04 20:40:20 UTC (rev 4780)
@@ -236,6 +236,9 @@
// initialize
selected = $day;
+
+ thisbox.format ++= static.formatWrite;
+
</bevel>
<lib.finalize />
@@ -284,10 +287,8 @@
}
-
- // SHOULD support more than DDMMYYYY
- /** sets the display format
- static.displayformatWrite = function(v) {
+ /** sets the display format */
+ static.formatWrite = function(v) {
switch (v) {
case "DDMMYYYY":
trapee.dateview[0] = trapee.dayview;
@@ -314,7 +315,7 @@
throw "Unsupported format: "+v;
}
cascade = v;
- }*/
+ };
static.viewsepWrite = function(v) {
@@ -405,113 +406,6 @@
s2 = expandYear(s2);
return new Date("YMD", s2,s1,s0);
}
- };
+ };
-
- /** TODO - REMOVE
- static.valueformatWrite = function(v) {
- switch (v) {
- case "DDMMYYYY":
- case "MMDDYYYY":
- case "YYYYMMDD":
- break;
- default:
- throw "Unsupported format: "+v;
- }
- cascade = v;
- }
-
- static.textRead = function() {
- var s = trapee.valueseparator != null ? trapee.valueseparator :
trapee.textseparator;
- var f = trapee.valueformat ? trapee.valueformat : trapee.displayformat;
- var y = trapee.year;
- var m = trapee.month;
- var d = trapee.day;
- if (y==null or m==null or d==null) {
- return "";
- }
- if (10>m) {
- // M->MM
- m = "0"+m;
- }
- if (10>d) {
- // D->DD
- d = "0"+d;
- }
- switch (f) {
- case "YYYYMMDD": return ""+ y + s + m + s + d;
- case "DDMMYYYY": return ""+ d + s + m + s + y;
- case "MMDDYYYY": return ""+ m + s + d + s + y;
- default: return "";
- }
- }
-
-
- static.valueRead = function() {
- switch (trapee.valuetype) {
- case "vexi.util.date":
- if (trapee.year==null)
- return null;
- return trapee.copy();
- case "vexi.js.Date":
- if (trapee.year==null)
- return null;
- return new vexi.js.Date("YMD",
- trapee.year,
- trapee.month,
- trapee.day);
- case "date": case "number":
- throw "unimplemented";
- case "string":
- default:
- var t = trapee.text;
- return t ? t : null;
- }
- }
-
- static.valueWrite = function(v) {
- if (v!=null and trapee.valuetype=="vexi.js.Date") {
- v = v+"";
- }
-
- if (v == "") {
- v = null;
- }
- switch (typeof(v)) {
- case "box":
- case "object":
- case "vexi.js.Date":
- if (v.day != trapee.day and v.month != trapee.month and v.year !=
trapee.year) {
- trapee.day = trapee.day;
- trapee.month = trapee.month;
- trapee.year = trapee.year;
- }
- break;
- case "date":
- trapee.date = v;
- break;
- case "number":
- trapee.date = vexi.date(v);
- break;
- case "null":
- trapee.day = null;
- trapee.month = null;
- trapee.year = null;
- break;
- case "string":
- if (v.toLowerCase() == "today") {
- value = vexi.js.Date.today.as("YMD");
- } else if (trapee.text == v) {
- break;
- } else {
- trapee.parseDate(v, trapee.valueformat, trapee);
- }
- break;
- default:
- throw "unsupported value type for datefield: '"+typeof(v)+"'";
- }
- return;
- }
- */
-
</vexi>
Added:
branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/widgets/datefield_format.t
===================================================================
---
branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/widgets/datefield_format.t
(rev 0)
+++
branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/widgets/datefield_format.t
2015-04-04 20:40:20 UTC (rev 4780)
@@ -0,0 +1,36 @@
+<!-- public domain -->
+
+<vexi xmlns:ui="vexi://ui" xmlns:w="vexi.widget" xmlns:poke="poke">
+ <w:surface />
+ <ui:box orient="vertical">
+ <ui:box orient="vertical">
+ <w:datefield id="date1" format="DDMMYYYY" />
+ <w:datefield id="date2" format="MMDDYYYY" />
+ <w:datefield id="date3" format="YYYYMMDD" />
+ </ui:box>
+ <ui:box>
+ <w:option id="choice" shrink="100">
+ <w:item text="DDMMYYYY" />
+ <w:item text="MMDDYYYY" />
+ <w:item text="YYYYMMDD" />
+ </w:option>
+ <w:datefield id="date4" />
+ </ui:box>
+
+ $date1.value = vexi.js.Date.today;
+ $date2.value = vexi.js.Date.today;
+ $date3.value = vexi.js.Date.today;
+ $date4.value = vexi.js.Date.today;
+
+ $choice.value ++= function(v){
+ cascade = v;
+ trace(v);
+ $date4.format = v;
+ };
+
+
+
+ vexi.ui.frame = thisbox;
+
+ </ui:box>
+</vexi>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn