zk框架 官方文档翻译2

来源:互联网 发布:java项目打包成war 编辑:程序博客网 时间:2024/06/15 08:01
  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>

 

 

 

 

0 0