2008-06-19

web dynpro for abap基础知识(2)

在web  dynpro中定义user interface

定义user interface相对比较简单,从左边栏的工具箱里拖拽需要的UI elements到layout里面,并设置各个UI element的属性。更多的工作是关于data binding。

有些UI elements是不可见的,如TransparentContainer, ViewUIElementsContainer。这类元素用于组织其他的可见元素,如Button, Label,InputField,Table,Tree等。所有的UI elements被组织成一个树状结构,根节点名为RootUIElement,类型为TransparentContainer。RootUIElement下的每个container element都有一个属性Layout,它规定了在container内元素的布局。4种layout manager可供layout属性选择:

FlowLayout
Rowlayout
MatrixLayout
GridLayout

如果一个UI element被绑定到了一个context内的node或attribute,那么这个node/attribute的值就会被赋给这个UI element。当UI element的值发生变化时,这种变化也会自动反映到context中的node/attribute上。这就是前面已经提及的data binding。这种绑定只能发生在同一个view的context和view controller之间。当想改变一个UI element的行为时,只需修改与这个UI element绑定的node/attribute。

UI elements如TextView,Label,Caption被用于显示文字。当这类UI elements被绑定到attribute,而attribute是与data dictionary中data element有关。这时这个data element的相应文字会被用于这个UI element。另一种情况是,a Label is related to a InputField, and the Text property of the Label is left blank. The label text then originates from the data element related to the InputField.

Composite UI Elements

有的UI element由多个基本的UI elements组成,如Table(由多个TableColumn构成)。每个TableColumn又由一个Caption和一个Cell editor(默认为TextView这种类型的UI)组成。Table这类UI element只能被绑定到cardinality为0..n或1..n的node。每个Table有一个属性selectionMode,有6个不同的值来控制行的选择,具体参见文档第86 - 87页。

没有评论:

发表评论