Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 368720

Summary: Cannot initialize a Dojo calendar with the value property or on-construction function
Product: z_Archived Reporter: Ben Margolis <margolis>
Component: EDTAssignee: lu lu <lulu>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: hjiyong, jinfahua, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Initial dojoCalendar with set value
none
set value while initializing dojoCalendar widget hjiyong: iplog+, lulu: review?, hjiyong: review+

Description Ben Margolis CLA 2012-01-16 10:29:23 EST
1.  The initial value property has no effect:

package mypkg;

import com.ibm.egl.rui.widgets.GridLayout;
import com.ibm.egl.rui.widgets.GridLayoutData;
import dojo.widgets.DojoCalendar;
import dojo.widgets.DojoButton;
import egl.javascript.Job;

handler MyHandler type RUIhandler {
   initialUI = [ ui ], onConstructionFunction = start,
   cssFile="css/MyRichUIProject.css", title="MyHandler"}

   ui GridLayout{ columns = 3, rows = 4, cellPadding = 4,
                  children = [ myCalendar ] };

   myCalendar DojoCalendar{ layoutData = new GridLayoutData{ row = 2, column = 2 }, value = "01/01/2014" };

  
   function start() 
//         strLib.defaultDateFormat = "yyyy/MM/dd";
//         myCalendar.value = "2015/01/01";
   end  
end

2.  You also get no effect if you remove (or keep) the value and uncomment the statements in the start function.
Comment 1 lu lu CLA 2012-01-19 05:58:41 EST
Had taken new comer training on Tue and Wed, and will take vacation from 1.20 to 1.28, so need to defer this defect to 0.8.0 I2. Thanks.
Comment 2 Brian Svihovec CLA 2012-01-19 13:56:11 EST
This does not appear to be a regression from .7, so I agree with deferring it until I2.
Comment 3 lu lu CLA 2012-01-30 00:32:39 EST
Hi Ben, 

Can you provide me with the build version? I am using the latest build - 0.8.0.v201201290903, and find some methods/properties should have been removed.

Eg. The property of 'strLib.defaultDateFormat' has been removed.

And for all Dojo widgets, they have an event named 'onWidgetLoad', in this method, you can use Calendar.value or Calendar.setValue("2004/04/08") to set the default DojoCalendar date value.
********************************************************************
function Calendar_onWidgetLoad(event Event in)
    	Calendar.value = DateTimeLib.dateFromGregorian(20040408);
        //Calendar.setValue("2004/04/08");
end
********************************************************************
Comment 4 Ben Margolis CLA 2012-01-30 15:50:07 EST
yes, defaultDateFormat is gone.  in the nightly build (1/29), the code shown later works as you say.  

is it impossible to cause an initialization to occur in the same two ways that initilization occurs in any non-Dojo widget?  the two ways:

o  in the widget declaration

o  in the on-construction function

if we can initialize the value in those locations, we should because then the EGL technology is consistent.

does Dojo widget initialization typically require that the EGL developer invoke the onWidgetLoad function?

************


package client;

import org.eclipse.edt.rui.widgets.GridLayout;
import org.eclipse.edt.rui.widgets.GridLayoutData;
import dojo.widgets.DojoCalendar;
import eglx.ui.rui.RUIHandler;

handler MyHandler type RUIhandler{initialUI =[ui], 
               onConstructionFunction = start, 
               cssFile = "css/MyRichUIProject.css", 
               title = "MyHandler"}

    ui GridLayout{columns = 3, rows = 4, cellPadding = 4, children =[myCalendar]};

     myCalendar DojoCalendar{layoutData = new GridLayoutData{row = 2, column = 2}, 
                          onWidgetLoad ::= onWidgetLoad };
                          
    function start()
        myCalendar.value = "01/01/2015"; // does NOT work
    end

    function onWidgetLoad(event Event in)
       // myCalendar.value = DateTimeLib.dateFromGregorian(20040408);
       myCalendar.value = "01/01/2016";
    end
end
Comment 5 lu lu CLA 2012-02-05 22:22:55 EST
Created attachment 210548 [details]
Initial dojoCalendar with set value

Initial dojoCalendar widget using the set value instead of current date(new date{}).

DojoCalendar widget can be used by those two ways:
   1. newcalendar DojoCalendar{ layoutData = new GridLayoutData{ row = 2, column = 2 }, value = "02/02/2018"}; <In DojoCalendar declaration>

   2. function start()
    	Calendar.value = "01/01/2018";    
      end
     <In start() function>

Hi JiYong, please help to review my changes. If you don't have other comments, please help to deliver it. Thanks. :-)
Comment 6 lu lu CLA 2012-02-05 22:51:40 EST
Created attachment 210549 [details]
set value while initializing dojoCalendar widget

Using base methods '_setProperty/_getProperty' to replace 'this.dojoWidget.attr' method. 

Thanks.
Comment 7 Huang Ji Yong CLA 2012-02-06 00:13:09 EST
Comment on attachment 210549 [details]
set value while initializing dojoCalendar widget

Committed
Comment 8 lu lu CLA 2012-02-06 00:26:19 EST
Resolve this bug.
JiYong, Thanks.
Comment 9 Ben Margolis CLA 2012-02-20 11:31:30 EST
confirmed in the Feb 20 build.

thank you.