zk框架 官方文档翻译2

  1. UI Controller

       To control the UI, firstly, you need to implement a controller class which inherits ZK'sSelectorComposer[1] for a ZUL. Then, you can retrieve the UI component's Java object by annotating @Wire on controller's member variables. After this has been done, you can then control and manipulate UI by accessing those annotated member variables.

       为了控制UI,首先,你必须在zul页面中去实现一个继承zk SelectorComposer[1]的控制器的接口。其次,你可以通过在成员变量上添加注解@Wire来获得组件的java对象。这一步完成以后,你就可以通过这些注解的变量来控制并且处理UI。

package foo; // some import statements are omitted for brevity. 
public class RegistrationComposer extends SelectorComposer<Component> {     
@Wire    
private Button submitButton;         
@Wire    
private Checkbox acceptTermBox;} 

 line 7,10 Variable names "submitButton" and "acceptTermBox" corresponds to components' id attributes which are specified at mentioned ZUL in the previous section.

第七行,第十行的变量 "submitButton" 和"acceptTermBox" 响应了上一区域提到的组件id属性制定的组件。

We can then use the controller above to control our UI components by specifying attribute "apply" in the ZUL.

我们可以通过使用上面的控制器通过明确zul页面中的属性“apply”去控制我们的UI组件。

 

<window border="normal" width="400px" title="Welcome! New User"apply="foo.RegistrationComposer">
<!-- omit other components for brevity -->
</window>

 

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值