package samples.client; import org.eclipse.edt.rui.widgets.GridLayout; import org.eclipse.edt.rui.widgets.GridLayoutData; import org.eclipse.edt.rui.widgets.GridLayoutLib; import org.eclipse.edt.rui.widgets.HTML; import org.eclipse.edt.rui.widgets.Image; import org.eclipse.edt.rui.widgets.TextField; import org.eclipse.edt.rui.widgets.TextLabel; import dojo.widgets.DojoButton; import dojo.widgets.DojoDialogLib; import eglx.http.HttpProxy; import eglx.lang.AnyException; import eglx.ui.rui.Event; import eglx.ui.rui.RUIHandler; import samples.server.HelloWorldService; handler HelloWorldView type RUIhandler { initialUI = [ configPanel ], onConstructionFunction = start, title = "Hello World" } configPanel GridLayout { columns = 3, rows = 5, cellPadding = 3, children = [ nameField, logoImage, headerLabel, instructionsLabel, goButton, yourNameLabel ], style = "-moz-border-radius: 15px; border-radius: 15px; box-shadow: 5px 5px 5px #ccc;", backgroundColor = "#d2ebba", padding = 8, margin = 20 }; headerLabel TextLabel { layoutData = new GridLayoutData { row = 1, column = 2 }, text = "Hello, EGL!", fontSize = "24pt" }; logoImage Image { src = "icons/EGL Logo 1.png", height = "150", layoutData = new GridLayoutData { row = 1, column = 1, horizontalAlignment = GridLayoutLib.ALIGN_CENTER, verticalSpan = 2 } }; instructionsLabel HTML { layoutData = new GridLayoutData { row = 2, column = 2, verticalAlignment = GridLayoutLib.VALIGN_MIDDLE }, text = "This application demonstrates an EGL Rich UI handler calling an EGL service.<ul><li>To run, switch to the <b>Preview</b> tab if in the EGL Rich UI Editor, enter your name, and click <b>Go</b>.<li>To view the source for the service, from the Project Explorer view double-click <b>HelloWorldService.egl</b> in the <b>samples.server</b> package.<li>To debug, set a breakpoint in the source of this handler or the service and launch in Debug mode (right-click in the Project Explorer view and select <b>Debug As > EGL Rich UI Application</b>).</ul>", width = "500" }; yourNameLabel TextLabel { layoutData = new GridLayoutData { row = 3, column = 2, horizontalAlignment = GridLayoutLib.ALIGN_CENTER }, text = "Enter your name:" }; nameField TextField { layoutData = new GridLayoutData { row = 4, column = 2, horizontalAlignment = GridLayoutLib.ALIGN_CENTER }, width = "200" }; goButton DojoButton { layoutData = new GridLayoutData { row = 5, column = 2, horizontalAlignment = GridLayoutLib.ALIGN_CENTER }, text = "Go!", onClick ::= goButton_onClick, tabIndex = 0 }; function start() nameField.focus(); end function goButton_onClick(event Event in) call HelloWorldService.sayHello (nameField.text) using new HttpProxy returning to displayResults onException displayError; end function displayResults(retResult string in) DojoDialogLib.showAlert(retResult); end function displayError(exp AnyException in) DojoDialogLib.showError("Error", exp.message, null); end end