package handlers; // RUI Handler import org.eclipse.edt.rui.mvc.Controller; import org.eclipse.edt.rui.mvc.FormField; import org.eclipse.edt.rui.mvc.FormManager; import org.eclipse.edt.rui.mvc.MVC; import org.eclipse.edt.rui.widgets.GridLayout; import org.eclipse.edt.rui.widgets.GridLayoutData; import org.eclipse.edt.rui.widgets.PasswordTextField; import org.eclipse.edt.rui.widgets.TextLabel; import dojo.widgets.DojoButton; import dojo.widgets.DojoTextField; import eglx.lang.AnyException; import eglx.services.DedicatedService; import eglx.ui.rui.Event; import eglx.ui.rui.RUIHandler; import eglx.ui.rui.Widget; import services.loginServices; // // delegate //delegate SwitchToPagePart( TargetPage STRING in) end handler loginclient2 type RUIhandler{initialUI =[ui ], onConstructionFunction = start, cssFile = "css/masterStyle.css", title = "loginclient2"} dbService loginServices?{@dedicatedService}; ui GridLayout{columns = 3, rows = 4, cellPadding = 4, children =[TextLabel, Button, myuser_ui]}; myuser User1; myuser_ui GridLayout{layoutData = new GridLayoutData{row = 2, column = 2}, rows = 2, columns = 2, cellPadding = 4, children =[ myuser_loginidtemp_nameLabel, myuser_loginidtemp_field, myuser_password_nameLabel, myuser_password_field]}; myuser_loginidtemp_nameLabel TextLabel{text = "Login Id", layoutData = new GridLayoutData{row = 1, column = 1}}; myuser_loginidtemp_field DojoTextField{layoutData = new GridLayoutData{row = 1, column = 2}}; myuser_loginidtemp_controller Controller{@MVC{model = myuser.username, view = myuser_loginidtemp_field}, validStateSetter = handleValidStateChange_myuser}; myuser_loginidtemp_formField FormField{controller = myuser_loginidtemp_controller, nameLabel = myuser_loginidtemp_nameLabel}; myuser_password_nameLabel TextLabel{text = "Password", layoutData = new GridLayoutData{row = 2, column = 1}}; myuser_password_field PasswordTextField{layoutData = new GridLayoutData{row = 2, column = 2}, maxLength = 10}; myuser_password_controller Controller{@MVC{model = myuser.password, view = myuser_password_field}, validStateSetter = handleValidStateChange_myuser}; myuser_password_formField FormField{controller = myuser_password_controller, nameLabel = myuser_password_nameLabel}; myuser_form FormManager{entries =[myuser_loginidtemp_formField, myuser_password_formField]}; Button DojoButton{layoutData = new GridLayoutData{row = 4, column = 2}, text = "Login", onClick ::= Button_onClick}; TextLabel TextLabel{layoutData = new GridLayoutData{row = 3, column = 2}, text = " "}; page2 SkillFileMaintenance{}; function start() end function myuser_form_Submit(event Event in) if(myuser_form.isValid()) myuser_form.commit(); end end function myuser_form_Publish(event Event in) myuser_form.publish(); myuser_form_Validate(); end function myuser_form_Validate() myuser_form.isValid(); end function handleValidStateChange_myuser(view Widget in, valid boolean in) for(n int from myuser_form.entries.getSize() to 1 decrement by 1) entry FormField = myuser_form.entries[n]; if(entry.controller.view == view) if(valid) // TODO: handle valid value else msg string? = entry.controller.getErrorMessage(); // TODO: handle invalid value end end end end function Button_onClick(event Event in) myUser_form_Submit(event); if(myUser.username != "" and myUser.password != "") call dbService.validuser(myUser.username) returning to callbackFunctionName onException exceptionHandlerFunctionName; else TextLabel.setText("Please enter UserId/Password"); end end function exceptionHandlerFunctionName(exp AnyException in) //Auto-generated method stub end function callbackFunctionName(retResult string in) if(retResult == "") TextLabel.setText("Invalid UserId"); else if(myUser.password == retResult) TextLabel.setText("Valid Login Detail"); ui.children = [page2.EmpDetail_ui,PAGE2.allskillRec_ui, page2.Buttonw ,PAGE2.LogOutButton,PAGE2.DeleteButton,PAGE2.editPane,PAGE2.detailButtonLayout,page2.selectedSkill_ui]; switchPart switchPart?; else TextLabel.setText("InValid Login Detail"); end end end end record User1 username string; password string; end