📄 z30-comppool.zul
字号:
<?xml version="1.0" encoding="UTF-8"?><!--desktop.zul{{IS_NOTE Purpose: Description: History: Wed Jun 21 18:59:49 2006, Created by tomyeh}}IS_NOTECopyright (C) 2006 Potix Corporation. All Rights Reserved.{{IS_RIGHT}}IS_RIGHT--><window id="box" title="Test Desktop Issues"> <zscript> import org.zkoss.zkdemo.test2.ComponentPools; List attached = new LinkedList(); </zscript> <vbox> Test: create components in an working thread and use them later <button label="Generates 5 components into pool" onClick="ComponentPools.generate(5)"/> <button label="Attach from pool"> <attribute name="onClick"> Component c = ComponentPools.next(); if (c != null) { String olduuid = c.uuid; box.appendChild(c); attached.add(c); new Label(" Attach " + c.uuid + "(old:"+olduuid+")").setParent(inf); } else { alert("No more component"); } </attribute> </button> <button label="Return last attached to pool"> <attribute name="onClick"> Component c = attached.isEmpty() ? null: attached.remove(attached.size()-1); if (c != null) { c.detach(); ComponentPools.add(0, c); new Label(" Dettach " + c.uuid).setParent(inf); } else { alert("No such component"); } </attribute> </button> </vbox> <div id="inf" style="border:1px solid orange"/></window>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -