`

openlaszlo组件的简单介绍

阅读更多

  openlaszlo组件的简单介绍 收藏
在写laszlo程序时,我们会用到很多组件的,官方的组建库lz componets,提供了绝大多数的应用。

 

这些组件是由一些简单的对象组合而成。

 

下面就通过几个简单的组建使用来了解下lz components:

 

<canvas width="100%" height="500">
    <silverstyle name="silvercolors"/>
    <greenstyle name="greencolors"/>
    <bluestyle name="bluecolors"/>

 

 

    <view id="s1" x="20" y="20">
        <view layout="spacing:20">

      <text>Choose a style to change colors...</text>

            <view name="stylechooser" layout="axis:x; spacing:4">
                <text>Style:</text>
                <combobox width="120" editable="false">
                    <handler name="onselect">
                        var colorchoice = this.getText();
                        canvas[colorchoice+'colors'].setAttribute("isdefault", true);
            </handler>   
<!-- handler 为"选择事件"的处理-->
                    <textlistitem text="silver"/>
                    <textlistitem text="green"/>
                    <textlistitem text="blue" selected="true"/>
                </combobox>
            </view>

<!--


stylechooser视图定义了一个颜色组合框。选择颜色的时候,程序的各个组件颜色改变。

-->

 

 


            <tabslider width="250" height="200">
                <tabelement text="holiday cheer" selected="true">
                    <radiogroup>
                        <radiobutton text="peace on earth"/>
                        <radiobutton text="joy to the world"/>
                        <radiobutton text="happy new year"/>
                    </radiogroup>
                </tabelement>
                <tabelement text="housewares">
                    <simplelayout axis="y" spacing="10"/>
                    <checkbox text="stainless steel"/>
                    <checkbox text="glassware"/>
                </tabelement>
                <tabelement text="isotope">
                    <text multiline="true" width="${immediateparent.width}">
                        Atoms that have the same number of protons but a different number of neutrons. They are atoms of the same element that have different masses. The isotope number is the number of protons plus the number of neutrons.
                    </text>
                </tabelement>
            </tabslider>

 

            <tabs>
                <tabpane>Insecticides
                    <simplelayout spacing="10" inset="10"/>
                    <radiogroup>
                        <radiobutton>Yes, I want to know more</radiobutton>
                        <radiobutton>No, I prefer to remain blissfully unaware</radiobutton>
                        <radiobutton>Please tell my neighbor, who may tell me</radiobutton>
                    </radiogroup>
                </tabpane>
                <tabpane text="Subliminal">
                    <button height="22">Submit</button>
                </tabpane>
            </tabs>
        </view>
</canvas>

 

以上程序主要写了三个组件,程序的演示效果如下:

 

 

openlaszlo组件分为"form components" 和 "general components,它们没有本质的区别。只是对<form>有所区别,比如说<button>可以放在<view>和<windows>里,但是不能包含在<form>中。

在lzx程序中<form>标签很少使用。

 

下面介绍使用组件的三种方法:

 

1、使用lzx的标签

 


<canvas height="100" width="100%">
    <simplelayout axis="x" spacing="10" inset="10"/>
    <list shownitems="4">
        <textlistitem>judy</textlistitem>
        <textlistitem>ann</textlistitem>
        <textlistitem>betsy</textlistitem>
        <textlistitem>sarah</textlistitem>
        <textlistitem>carol</textlistitem>
        <textlistitem>danah</textlistitem>
    </list>

    <radiogroup>
        <radiobutton text="apple"/>
        <radiobutton text="cherry"/>
        <radiobutton text="key lime"/>
    </radiogroup>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2007, 2008 Laszlo Systems, Inc.  All Rights Reserved.                   *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->使用标签的时候,里面没有脚本<script>2、使用脚本函数(script api)实际使用中,我们要动态的生成一些空间,或则处理组件的事件。<canvas height="150" width="100%">
  <simplelayout/>
  <!--Here is a button created with a tag -->
  <button name="framitz" width="50">
   hello
  </button>
  <script>
  //And here is a button created with using script
   var b = new lz.button();
     b.setAttribute("width", 50);
     b.setAttribute("height", 50);
   </script>
</canvas>
<canvas height="150" width="100%">
    <simplelayout spacing="10"/>
    <list id="mylist" height="82">    
        <textlistitem text="something"/>
    </list>

    <view layout="axis:x;spacing:4">
        <edittext id="item" text="new item"/>
        <button text="Add" isdefault="true">
            <handler name="onclick">
               mylist.addItem(item.getText());
            </handler>
        </button>
    </view>
</canvas>

 

3、使用数据驱动(data-driven componets)或则说数据绑定(databinding)

 

<canvas height="200" width="100%">
    <dataset name="mydata" src="resources/contacts.xml" request="true"/>
    <simplelayout axis="x" spacing="10" inset="10"/>
    <list id="a">
        <textlistitem datapath="mydata:/contacts/person" text="$path{'@firstname'}"/>
    </list>

    <list id="b" shownitems="4">
        <textlistitem datapath="mydata:/contacts/person" text="$path{'@firstname'}"/>
    </list>
</canvas>

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zclmoon/archive/2009/11/30/4907557.aspx

分享到:
评论

相关推荐

    OpenLaszlo-SAMSIG-05.ppt

    OpenLaszlo is the leading open source platform for the development and delivery of rich Internet applications on the World Wide Web.

    openlaszlo本地帮助文档

    英文版的openlaszlo的使用手册,html格式的。 哪位如果能做成chm或者pdf的就更好了。 openlaszlo是RIA的一种实现,个人感觉比Flex要灵活的多。

    OpenLaszlo —— 一个快速构建和部署富 Internet 应用程序的平台

    OpenLaszlo —— 一个快速构建和部署富 Internet 应用程序的平台 -- Linux,C,C++,Java,Ajax,XML,perl,php,python,ruby,MySQL,Gnome,KDE,Qt,Gtk,bash,shell,嵌入式,网络,信息安全,操作系统,数据结构,编译原理

    Applet & Openlaszlo

    Applet与Openlaszlo的通信。 采用此方式可以做相关的软件在线安装,上传,下载的FLASH效果。

    openlaszlo-4.9.0-windows-dev-install.part2.rar

    openlaszlo应用程序开发使用的是基于XML的LZX语言,它可以被编译成DHMTL,SWF等格式。 openlaszlo可作为openmeetings客户端的编译。 因安装程序90+MB,所以切分为两个压缩包。 openlaszlo-4.9.0-windows-dev-install....

    openlaszlo-4.9.0-windows-dev-install.part1.rar

    openlaszlo应用程序开发使用的是基于XML的LZX语言,它可以被编译成DHMTL,SWF等格式。 openlaszlo可作为openmeetings客户端的编译。 因安装程序90+MB,所以切分为两个压缩包。 openlaszlo-4.9.0-windows-dev-install....

    openlaszlo-4.7.3-windows-dev-install (1).exe

    openlaszlo应用程序开发使用的是基于XML的LZX语言,它可以被编译成DHMTL,SWF等格式。 是openmeetings视频会议系统的默认开发编译工具。

    openlaszlo计算器

    这是用Openlaszlo开发的计算器程序,可以实现基本的计算操作。 我是刚学openlaszlo,欢迎朋友们提出宝贵意见!

    论文研究-使用OpenLaszlo构建J2EE中的RIA程序 .pdf

    使用OpenLaszlo构建J2EE中的RIA程序,高春阳,龚群侃,当前,Web 应用程序就要进入了一个新的时期,富互联网客户端(RIA ,Rich Internet Application) 以其极大地用户交互性、优秀的外观设计、良好��

    LaszloMathML-开源

    一个OpenLaszlo组件,支持MathML的解析和渲染

    geoar:WMSWFS OpenLaszlo 客户端

    Geoar - WMS/WFS OpenLaszlo 客户端GeoAr 是 WMS 和 WFS 服务的富客户端实现。 它是在 LZX (OpenLaszlo) 上开发的,因此它向用户的浏览器提供 dhtml 或 flash,从而提供在它们之间进行选择的机会,但只有一个服务器...

    OpenLaszlo-开源

    OpenLaszlo是一个开放源代码平台,用于创建单页应用程序,这些应用程序可以编译为Flash或HTML5进行Web部署。 该项目的站点位于http://openlaszlo.org。

    Laszlo技术手册续

    这是Laszlo与web的PPT! 希望对希望让laszlo与web结合的朋友有所帮助!

    OpenMeetings的网络视频会议系统的研究_彭凌华.pdf

    该论文对OpenMeetings进行了简单介绍,对OpenMeetings入门有帮助。 该文介绍了基于开源框架OpenMeetings的网络视频会议系统的环境介绍以及总体设计 该系统支持音频视频能共享每个 与会者的桌面 它还包含一个白板...

    spket1.6.18

    js openlaszlo智能提示,很好用的工具,这是eclipse的插件

    huoyan.zip_火焰识别c++

    api c++ 火焰效果 绚丽的效果,而openlaszlo最终也是编译成swf来运行

    openMeetings二次开发高手的七篇文章

    PhMeetings是基于开源WEB视频会议系统OpenMeetings开发的一个实验性...由于资料的缺乏以及对OpenLaszlo编程的陌生,其中艰辛不足为外人道。今日发一声感慨:如果你想折磨一个程序员,那就让他去干开源软件的二次开发!

    Laszlo Faces-开源

    该项目旨在提供一个库,用于将OpenLaszlo富Web应用程序与基于JSF的服务器端组件集成在一起。

    英文原版-Laszlo in Action 1st Edition

    OpenLaszlo is an increasingly popular open-source platform for the development and delivery of rich internet applications across multiple platforms: Flash, DHTML, and J2ME. The dramatic emergence of ...

    FlashBuilder_4_LS10.part01.rar

    FlashBuilder开发工具,是开发java网页及OpenLaszlo,Laszlo富客户端必备工具。本人安装在电脑运行正常。

Global site tag (gtag.js) - Google Analytics