📄 z35-portallayout-0006.zul
字号:
<?xml version="1.0" encoding="UTF-8"?><!--Z35-protal-0001.zul{{IS_NOTE Purpose: Description: History: Tue May 6 09:29:59 TST 2008, Created by DennisChen}}IS_NOTECopyright (C) 2008 Potix Corporation. All Rights Reserved.{{IS_RIGHT}}IS_RIGHT--><window title="Grid with Group feature" border="normal">
<groupbox open="false"><caption label="instructions(click to open)"/><html><![CDATA[
Dynamic Change Portal width Attribute
1.add protal child, this will create a penal and set average width
2.set all portal children width to 20%,50%,70%
]]></html></groupbox> <zscript>
<![CDATA[//@IMPORT
import org.zkoss.zkmax.zul.*;
]]>
<![CDATA[//@DECLARATION
List panels = new ArrayList();
void addPortalChidren(){
Portalchildren pc = new Portalchildren();
panels.add(pc);
pc.setParent(pl);
newPanel(pc);
int avg = (int)(100/panels.size());
setAllWidth(avg);
}
void setAllWidth(int width){
int s = panels.size();
for(int i=0;i<s;i++){
panels.get(i).setWidth(width+"%");
}
}
int count=1;
Panelchildren newPanel(Component parent){
Panel panel = new Panel();
panel.setTitle("panel"+count++);
Panelchildren pc = new Panelchildren();
pc.setParent(panel);
panel.setParent(parent);
new Button(panel.getTitle()).setParent(pc);
return pc;
}
boolean setB = false;
void setBorderStyle(){
if(setB){
st.setContent("");
}else{
st.setContent(".z-portal-children{border : red solid 1px;}");
}
setB = !setB;
}
]]>
<![CDATA[
]]>
</zscript>
<style id="st">
</style>
<div>
<button label="1.add protal child" onClick="addPortalChidren()"/>
<button label="set all width 20%" onClick="setAllWidth(20)"/>
<button label="set all width 50%" onClick="setAllWidth(50)"/>
<button label="set all width 70%" onClick="setAllWidth(70)"/>
<button label="set all width to average" onClick="setAllWidth((int)(100/panels.size()))"/>
<button label="-.invalidate" onClick="pl.invalidate()"/>
<button label="-.re/set border style" onClick="setBorderStyle()"/>
<portallayout id="pl">
</portallayout>
</div>
</window>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -