Last updated by admin 4 years ago
proposal of Laszlo UI on Grails
Scaffolding Controller, Views and LZX related OpenLaszlo
Laszlo on Grails will offer the developer template's artifacts including LZX in which OpenLaszlo is assumed to be one of the components of view in this web application by scaffolding. Also it auto-generates Controller class and Views related OpenLaszlo.What is OpenLaszlo?
OpenLaszlo is an open source platform for developing user friendly web based applications, which work identically across all popular browsers and platforms. Currently OpenLaszlo generates Rich Internet Applications of Flash files and also next version of OpenLaszlo will be able to generate DHTML including Ajax in same LZX language, which is a kind of XML Markup Language.Command Line Options' List
In laszlo on Grails, the following command options can be used:linux$ grails
Buildfile: /home/ichan/pj/grails-0.2.1/src/grails/build.xmlhelp:
[echo] Usage: grails [target]
[echo]
[echo] Targets:
[echo] "create-app" - Create a new grails app
[echo] "create-controller" - Create a new controller
[echo] "create-service" - Create a new service
[echo] "create-domain-class" - Create a new domain class
[echo] "create-test-suite" - Create a new test suite
[echo] "create-job" - Create a quartz scheduled job
[echo] "generate-controller" - Generates a controller from a domain class
[echo] "generate-views" - Generates the views from a domain class
[echo] "generate-all" - Generates the all artifacts from a domain class
[echo] "install-dojo" - Installs the Dojo toolkit into the current project
[echo] "install-laszlo" - Installs OpenLaszlo Servlet into $GRAILS_HOME <-- added by Laszlo on Grails
[echo] "generate-laszlo" - Generates the lzx files from a domain class <-- added by Laszlo on Grails
[echo] "remove-laszlo" - Un-installs OpenLaszlo Servlet from $GRAILS_HOME<-- added by Laszlo on Grails
[echo] "test-app" - Run current app's unit tests
[echo] "run-app" - Run the application locally and wait
[echo] "create-webtest" - Create the functional test layout
[echo] "run-webtest" - Run the functional tests for a running app
[echo] "war" - Creates a deployable Web Application Archive (WAR)
[echo] "shell" - Opens the Grails interactive command line shell
[echo] "console" - Opens the Grails interactive swing console
[echo]BUILD SUCCESSFUL
Total time: 1 secondCongeniality between Controller and OpenLaszlo Dataset object
OpenLaszlo has a kind of objects, called LzDataset Class, managed XML data via XPath. This object is able to get XML data directly from Web server. So even if a Controller action like 'list' can render only a XML data, it is easy to displsy a XML data into dataset and grid objects such as <TABLE> tag in HTML:class UserController { def list = {
def users = []
if(!params.keyword)
users = User.list(10)
else
users = User.get(Integer.parseInt(params.keyword))
render(contentType:"text/xml",encoding:"UTF-8") {
rowset {
for(u in users) {
row(name:u.name,address:u.address)
}
}
}
}
}<?xml version="1.0" encoding="UTF-8"?> <canvas debug="false" bgcolor='#D4D0C8'> <dataset name='dset' request='true' type='http' src='/app/user/list?keyword='/> <grid id="gd" datapath="dset:/rowset" contentdatapath="row" doesenter="true"> <gridcolumn width='100'>name<text datapath='@name'></text></gridcolumn> <gridcolumn width='100'>email<text datapath='@email'></text> </gridcolumn> </grid> </canvas>
GSP tag for OpenLaszlo
The following tags can be used to display OpenLaszlo in the GSP file:<head> <g:lpsJs src="embed.js" /> <g:lpsJs src="script.js" /> </head> <body> … <g:lzEmbed src="sample.lzx" width="400" height="300" color="#FFFFFF"/> … </body>
<head> <script type="text/javascript" src="/appname/lps/includes/embed.js"></script> <script type="text/javascript" src="/appname/lps/includes/script.js"></script> </head> <body> … <script type="text/javascript" language="JavaScript"> lzEmbed({url:"/appname/lzx/sample.lzx?lzt=swf", width:"400", height:"300", bgcolor:"#FFFFFF"}); </script> … </body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase= "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0" width="400" height="300"> <param name="move" value="/appname/lzx/sample.lzx?lzt=swf" /> <param name="quality" value="high" /> <param name="scale" value="noscale" /> <param name="salign" value="LT" /> <param name="bgcolor" value="#FFFFFF" /> <embed src="/appname/lzx/sample.lzx?lzt=swf" quality="high" scale="noscale" width="400" height="300" bgcolor="#FFFFFF" type="application/x-shockwave-flash" pluginspage= "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" /> </object>



