- 浏览: 497186 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (185)
- job (15)
- linux/windows/unix/bash/shell (31)
- JAVA/J2EE/spring/hibernate/struts (30)
- VC/C++ (48)
- mysql/postgresql (6)
- php/jsp/asp/pear (1)
- FMS/flex/openlaszlo/red5/openmeetings (34)
- apache/tomcat/ftp/svn (6)
- xen/vm/Hadoop/cloudcompute (6)
- visual studio/eclipse/zendstudi/ant (8)
- others (1)
- windows异常处理 __try __except (1)
- (1)
- matlab (4)
- android (0)
最新评论
-
hongzhounlfd:
很透彻,很详细
依赖注入和控制反转 -
jefferyqjy:
谢谢~言简意赅~很明了!
依赖注入和控制反转 -
elderbrother:
太好了,谢谢
依赖注入和控制反转 -
east_zyd_zhao:
终于搞明白了
依赖注入和控制反转 -
Dremeng:
完美,一看就懂理解透彻
依赖注入和控制反转
constraint 表示可变的变量赋值形式
In LZX, a constraint is an attribute whose value is a function of other attribute values. The syntax for coding a constraint is
$when
{expression
}
where:
-
$
is the token indicating a constraint -
is an optional compiler directive:when
immediately
,once
, oralways
.$always{
can be abbreviated toexpression
}${
expression
} -
{
and}
are tokens delimiting the expression to be evaluated -
is a JavaScript expressionexpression
As we have seen above, whenever the value of an attribute changes, its on
event is generated. Because a constraint is an attribute whose value is dependent upon the values of one or more other attribute(s), the value of the constraint is recalculated whenever it receives the on
event for the attributes on which it depends.
Consider
<view name="someView" width="${someAttribute + someOtherAttribute}" />
The value of someView.width
is recomputed whenever an onsomeAttribute
or onsomeOtherAttribute
event occurred.
So for example
<view name="beatles" width="${this.paul.width + 28}"> <view name="paul" onclick="clickhandler()" > <!-- clickhandler method here to increase paul's width based on user clicking mouse --> </view> </view>
The width of beatles
will increase or decrease as a function of paul
's width; the expression this.paul.width + 28
is a constraint.
When the user clicks on the paul
view, the clickhandler will adjust the size of the paul
view. This change will be reported to the ${this.paul.width + 28}
constraint, which will then adjust the beatles
view to the width of the paul
view plus an additional 28 pixels. All of these steps are invisible to the user because they occur instantly.
This, of course is a trivial example, but it serves to make the point that in declaring the structure of your objects in LZX you also declare the rules by which they will relate to each other. Constraints are a fundamental concept in LZX programming, and learning to "think in LZX" is a mostly a matter of learning to properly model your system's behavior in terms of the constraints on its constituent parts. Chapter 27, Constraints covers constraints in depth.
An LZX application is expressed as a hierarchy of objects, usually visual objects, all of which are contained in a single object called the Canvas. Recall that LZX programs are XML documents, the Canvas is the root element. The simplest LZX program is thus:
<canvas/>
This program compiles and executes, but has no output. As the simplest visual object is the View, a minimal LZX program would look something like:
<canvas> <view> <text> Hello World!</text> </view> </canvas>
This code clearly defines a hierarchy of three objects. We can make their visual relationship more visible by giving the canvas and view sizes and background colors:
In this simple case, the lexical hierarchy in the code corresponds to the visual hierarchy in the canvas. In fact, a <text>
object is an instance of a class derived from <view>
. The typical LZX program repeats this pattern on a larger scale: the canvas contains views which contain other views, and so forth. Classes are used to replicate view groupings; components such as buttons, windows, input fields and sliders are examples of classes built from views.
LZX affords a variety of ways to simplify the relationships among views. For example, there are several categories of layouts that handle the "housekeeping" of placing views in relationship to each other. These are described in Chapter 17, Layout and Design.
However, the relationship between the textual hierarchy in the code and the visual hierarchy on the canvas is not always as neat as in the example above. In particular, LZX's powerful data binding semantics make it possible for a single <view>
tag in the text to cause the creation of an arbitrary number of instances of view
objects. In such cases it becomes very important to have a precise way of talking about complex relationships among objects. Chapter 26, Views covers this topic in depth.
In LZX the concepts of local and global namespaces, or scopes, are basically the same as in JavaScript. Having said that, it should be pointed out that JavaScript follows rules that are sometimes surprising to Java Programmers.
In JavaScript, all variables are global unless they are preceded by the keyword var
.
Thus
a = 7; // defines a global variable a
and
var a = 7 // defines a local variable a
This syntax means, for example, that an assignment in a method definition can set an instance of a global variable:
for (a = 0; a <n; a++);
Creates a global variable named a
, or changes the value of this variable if it already exists. What the programmer meant to write was
for (var a = 0; a <n; a++);
In LZX, the name
attribute is local and the id
attribute is global. Thus
<canvas> <view name="john" id="grandfather"> <view name="john" id="father"> <view name="john" id="son"/> </view> </view> </canvas>
is a valid name scheme. The innermost view can be referenced by Canvas.john.john.john
or simply son
.
As will be discussed below, functions created using the <script>
tag can be accessed from anywhere in the program.
发表评论
-
Red5安装和配置
2011-02-24 10:23 4048Red5安装和配置参考网页:http://www.cahblo ... -
基于Moodle平台的网站调查报告
2011-02-24 10:18 2576基于Moodle平台的网站调查报告 网站举例: ² 西南 ... -
moodle插件模块功能汇总
2011-02-24 10:03 5013Moodle官方提供654种插件或者模块moodle.org ... -
moodle 一体包安装手册(window)
2011-02-24 09:55 1285见附件 -
moodle中上传文件大小控制
2011-02-24 09:51 1842第一步:修改在php4下POST文件大小的限制1.编修php. ... -
linux下面安装moodle
2011-02-24 09:50 20851. 安装moodle运行 ... -
OpenMeetings安装文档
2011-02-15 11:09 2602OpenMeetings 是一个多语言可定制的视频会议和协作系 ... -
Compilation and Execution (openlaszlo)
2010-11-22 11:02 10507. Compilation and Exe ... -
Combining Tags and Script in LZX Programs (openlaszlo)
2010-11-22 11:01 13206. Combining Tags and ... -
Data Access, Manipulation, and Binding (openlaszlo)
2010-11-22 10:33 11965. Data Access, Manipu ... -
Events and Methods (openlaszlo)
2010-11-22 09:35 13743. Events,Methods ,han ... -
Dimdim&Moodle安装配置文档节选
2010-11-09 17:40 2550Dimdim&Moodle安装配置文档节选 ... -
Red5如何响应rmpt的请求,中间涉及哪些关键类?
2010-11-01 15:35 1544Red5如何响应rmpt的请求,中间涉及哪些关键类? 响应请 ... -
red5的eclipse插件和用法
2010-10-30 20:56 1141参见http://www.red5.org/wiki/Red5 ... -
red5集群分析
2010-10-28 19:42 50291. 边(Edge ): 1. 边的主要作用是管理连接,并可以 ... -
red5源代码分析
2010-10-26 08:59 3869Red5如何响应rmpt的请求 ... -
创建第一个red5程序
2010-10-25 15:33 21491.下载最新版本的RED5 http://osflash.or ... -
openlaszlo中多媒体组件介绍
2010-10-14 15:50 1130在openlaszlo中我们可以处理图像,音视频等媒体文件。详 ... -
openlaszlo组件的简单介绍
2010-10-14 15:50 1293openlaszlo组件的简单介绍 收藏 在写laszlo ... -
创建一个简单的openlaszlo程序
2010-10-14 15:49 1072前面说到过openlaszlo程序是一组xml格式和javas ...
相关推荐
- **声明式约束(Declarative Constraints)**:简化复杂逻辑的表达。 - **编译时优化(Compiler-time Optimization)**:提高运行效率。 - **组件库(Component Library)**:包含各种控件,如按钮、复选框、树形结构、...
Synopsys Timing Constraints and Optimization User Guide Timing Constraints(时序约束)是数字集成电路设计中的一种重要技术,用于描述和约束数字电路的时序行为。 Synopsys Timing Constraints and ...
airflow的安装文件constraints-3.8.txt
### Xilinx Constraints Guide详解 #### 一、引言 Xilinx公司是全球领先的可编程逻辑器件供应商之一,其产品广泛应用于通信、消费电子、汽车、工业控制等多个领域。随着技术的发展,Xilinx不断推出高性能的FPGA...
在"predictive control with constraints"这一主题中,我们将深入探讨如何在满足特定约束条件下进行有效的预测控制。 预测控制的核心是预测模型,它可以是基于动态方程、状态空间模型或者数据驱动的模型。这个模型...
airflow的安装文件constraints-3.7.txt
airflow的安装文件constraints-3.9.txt
airflow的安装文件constraints-3.6.txt
Predictive_Control_with_Constraints
大型数据集的处理对于度量学习提出了挑战,而"Large Scale Metric Learning from Equivalence Constraints"则是针对这一问题提出的一种解决方案。该代码实现,即"KISSME"(Key-Insight into Similarity Metric for ...
#### 标题:时序约束(Timing Constraints) **时序约束**在Xilinx FPGA设计中扮演着至关重要的角色,它确保了最终设计能够在目标工作频率下稳定运行。Xilinx时序约束用户指南(Timing Constraints User Guide)是...
metric learnig
关键词“Constraints”指的是算法设计中必须考虑的限制条件,如时间限制、预算限制等。这些约束条件对算法的搜索空间和最终路径的选择有着决定性的影响。而“Path Searching”则是算法在给定的图或网络中寻找特定...
本节主要介绍如何从UCF(User Constraints File)迁移到XDC(Xilinx Design Constraints)格式,并对XDC约束的基本概念进行了概述。XDC约束文件提供了更灵活、更强大的方式来定义时序和物理约束,相比UCF具有更多的...
### SSD7 Unit1 Skill Builder: Identifying Keys and Integrity Constraints B #### 客户表 (Customer) **主键(Primary Key, PK):** - **ID**: 每个客户都有一个唯一的标识符,用于区分不同的客户。这个字段是...
input constraints Ali Saberi School of Electrical Engineering and Computer Science Washington State University Pullman, WA 99164-2752 U.S.A. Fax: (509) 335-3818 E-mail: saberi@eecs.wsu.edu Anton A. ...
本文“On portfolio optimization: Imposing the right constraints”由Patrick Behr、Andre Guettler和Felix Miebs撰写,探讨了一种基于收缩理论的约束最小方差投资组合策略,对传统投资策略进行了重新评估。...
文章提出了一种名为SAIL1(String Matching with Wildcards and Length Constraints)的高效算法,该算法能在非线性时间内返回模式`P`在文本`T`中的每一次出现,并且只需要线性的额外空间。具体来说,对于长度为`n`...
在这篇关于"Local Distance Preservation in the GP-LVM through Back constraints"的文献中,作者主要探讨了高斯过程潜在变量模型(GP-LVM)的扩展,这种方法通过后向约束(back constraints)来保留局部距离,与...