31:HelloWorld42:HelloWorld133:HelloWorld204:HelloWorld275:HelloWorld+3337Eclipse3738NovcomNotRunning3839Listener39AlertDialogBox3940(SDK)40SDK()404040:01/08/2009http://www.pre-dict.blogspot.com14041:01/08/2009http://www.pre-dict.blogspot.com2MojoSDK,,,,MojoSDK.WebOS,MojoSDK,,,,Blog:Prē-Dict:http://www.pre-dict.blogspot.comPrē-DictTwitter:http://twitter.com/pre_dict,,:E-mail/Facebook:ted.wong.0430@gmail.comTwitter:http://twitter.com/tedwong0430,MojoSDK,,,,.,.:01/08/2009http://www.pre-dict.blogspot.com31:HelloWorld,,,,HelloWorld,HelloWorld.:,,,DialogHello.(MojoSDK,,)•1:EclipseFileNewMojoApplication•2:”Finish”:01/08/2009http://www.pre-dict.blogspot.com4•3:EclipseWindowsOpenPerspectiveOtherswebOSOKProjectExplorerHelloWorld::01/08/2009http://www.pre-dict.blogspot.com5:01/08/2009http://www.pre-dict.blogspot.com6•4:ProjectExplorerHelloWorldFolderNewMojoScene•5:,Scene,SayHello:01/08/2009http://www.pre-dict.blogspot.com7,ProjectExplorerEclipse,say-hello-assistant.jssay-hello,say-hello-scene.html,sources.json: {scenes:say-hello,source:app\/assistants\/say-hello-assistant.js }Scene,sayHello.say-hello-assistant.js.say-hello-scene.htmlsceneUI.•6:PalmSimulator,ProjectExplorerHelloWorldFolderRunAsMojoApplicationWebOSEmulator,::01/08/2009http://www.pre-dict.blogspot.com8•7:WebOS,,Scene,,index,assistantstage-assistant,methodStageAssistant.prototype.setup(),index,,Scene,,Scenesay-hello,method,controllersay-helloscenescene,stage-assistant.jsmethod:StageAssistant.prototype.setup=function(){ this.controller.pushScene(say-hello);}•8:UI,UIHTML+CSS,,say-hello-scene.htmlSourceCodedivid=yourNamex-mojo-element=TextField/divdiv/divdivid=submitx-mojo-element=Button/div:01/08/2009http://www.pre-dict.blogspot.com9x-mojo-element,webOSwidget,,3divtag,Textfield,,idyourName,button,idsubmit.id,,,,.•9:say-hello-assistant.js,,setup,activate,deactivatecleanupmethod,,,.Scene,setup,widgetsetup,listener.setupmethod::01/08/2009http://www.pre-dict.blogspot.com10SayHelloAssistant.prototype.setup=function(){varattributes={//attributeshintText:$L('YourName...'),/*,*/};this.model={value:,//Textfielddisabled:false//}; /*idyourNamewidgetattributesmodel, *mojotextfield */this.controller.setupWidget(yourName,attributes,this.model); /*,,*idsubmitwidgetthis.attributes, *this.attributes,,model, *buttonLabelsubmit **/this.controller.setupWidget(submit,this.attributes={},this.model={buttonLabel:submit}); /*controllerlistenidsubmitwidget, *listentap, *listen,sayHello **/this.controller.listen(submit,Mojo.Event.tap,this.sayHello.bind(this)); }•10:Listenersubmit,sayHellomethod.,sayHellomethod:SayHelloAssistant.prototype.sayHello=function(){ /*errorDialog,Hello, idyourNamemojowidgetvalue, Hello. */Mojo.Controller.errorDialog(Hello+ this.controller.get(yourName).mojo.getValue());};•11:run,,1.yourName,submit2.yourName,.:01/08/2009http://www.pre-dict.blogspot.com11CSS,PalmCSS,,,,Palm.say-hello-scene.html:!--palm-text-wrapper,,--divid=yourNamex-mojo-element=TextFieldclass=palm-text-wrapper/div!--spacer,submitbuttonyourNametextfield--divclass=palm-header-spacer/divdivid=submitx-mojo-element=Button/div,::01/08/2009http://www.pre-dict.blogspot.com122:HelloWorldHelloWorld,,HelloWorldWebOSHelloWorld,,,HelloWorld,HelloWorld.HelloWorldToggleButtonCookies.CookiesCookies,,.(Google)ToggleButton,iPhone,,iPhoneon/off,T/F,ComboBox,/.,.WebOS,.,,ToggleButton,Submit,.(,Cookie,Database,Database)•1:Views,Views,:HelloWorldappviewssay-hellosay-hello-scene.htmlUI::01/08/2009http://www.pre-dict.blogspot.com13(HelloWorld),ForgetMe.?submit,UIforgetDIV,submit:!--forget--divid=forgetx-mojo-element=Button/div•2:ToggleButtonRememberMeLabel!--palm-row-wrapperstyleDiv--divclass=palm-row-wrapper!--ToggleButton--divid=rememberx-mojo-element=ToggleButton/div!--class=titleleftpalm-text-wrapperRememberMe,ToggleButton--divclass=titleleftpalm-text-wrapperRememberMe/div/div•3:,,MojoWidget,?,:HelloWorldappassistantssay-hello-assistant.jsSayHelloAssistant.prototype.setup:01/08/2009http://www.pre-dict.blogspot.com14forgetButton,,,CodesetupsubmitWidget:/*forgetButton*/this.controller.setupWidget(forget,this.attributes={},this.model={buttonLabel:ForgetMe});•4:ToggleUI,CookiesCookies.(Boolean),Cookiesobject.Javascript,DataType,.SayHelloAssistant()Constructor,(variables),remembercookie.functionSayHelloAssistant(){this.remember;/**/this.cookie;/*CookiesObject*/}Setup,assign.setupSayHelloAssistant.remember=true;//TrueSayHelloAssistant.cookie=newMojo.Model.Cookie(myCookies);//MojoModelCookie,myCookiesid:01/08/2009http://www.pre-dict.blogspot.com15•5:ToggleButton,ToggleButtonTextField,forgetbutton,UI./**ToogleButton**/this.controller.setupWidget(remember,this.attributes={trueLabel:'Yes',//LabelYesfalseLabel:'No',//LabelNo},this.model={value:SayHelloAssistant.remember,//remember});•6:,,Cookies: vardisplayName=;//,if(SayHelloAssistant.cookie.get()!=null){/*cookienull()*/displayName+=SayHelloAssistant.cookie.get().yourName;/*cookie,yourNameassigndi