Thanks for the response, unfortunately does not work for me.
The panel.appendChild(new Caption()) throws:
org.zkoss.zk.ui.UiException: Unsupported child for Panel: [caption ]
JustinFrost ( 2013-04-29 07:38:49 +0800 )editFirst time here? Check out the FAQ!
Hi all,
I need to customise the title bar of a panel in java code. At the moment I have a panel as such:
Panel p = new Panel();
p.setTitle("Panel Title");
p.setCollapsible(true);
p.setClosable(false);
p.setMaximizable(false);
I need to add some tollbarButtons or a drop down menu on the titlebar without loosing the collapse button and title.
Do I use a caption to do this ? If so how do I add it to the titlebar there is no setCaption() methods on the panel and it only accepts panelChildren children.
Cheers for any assistance.
<panel title="test" collapsible="true" border="normal">
<caption>
<toolbar style="float: right;">
<toolbarbutton label="one" />
<toolbarbutton label="two" />
</toolbar>
</caption>
<panelchildren>
<label value="hello toolbar" />
</panelchildren>
</panel>
That is the ZUL way to achieve this.
in Java:
panel.appendChild(new Caption());
Toolbar t = new Toolbar();
t.setStyle("float: right;");
root.getCaption().appendChild(t);
Toolbarbutton b1 = new Toolbarbutton("one");
Toolbarbutton b2 = new Toolbarbutton("two");
t.appendChild(b1);
t.appendChild(b2);
Giovanni
Thanks for the response, unfortunately does not work for me.
The panel.appendChild(new Caption()) throws:
org.zkoss.zk.ui.UiException: Unsupported child for Panel: [caption ]
JustinFrost ( 2013-04-29 07:38:49 +0800 )editI tested this code and it works fine... what version of ZK are you using? I checked wuth 6.5.2 EE and 6.5.1 CE and it works...
<zk>
<panel id="root" title="test" collapsible="true" border="normal">
<panelchildren>
<label value="hello toolbar" />
</panelchildren>
</panel>
<zscript><![CDATA[
root.appendChild(new Caption());
Toolbar t = new Toolbar();
t.setStyle("float: right;");
root.getCaption().appendChild(t);
Toolbarbutton b1 = new Toolbarbutton("one");
Toolbarbutton b2 = new Toolbarbutton("two");
t.appendChild(b1);
t.appendChild(b2);
]]></zscript>
</zk>
Sorry gganassin, my mistake I use using the wrong Caption class...Thanks for your help.
JustinFrost ( 2013-04-29 08:07:27 +0800 )editAsked: 2013-04-26 08:59:05 +0800
Seen: 44 times
Last updated: Apr 29 '13
composite component help [closed]
EL in a forEach @command not working?
Different template for each grid row
Cardlayout animation is broken
Grid RowRender slow using 6.5.1 and sizable=true
setVisible(false), component will load or not
Decimalbox and doublebox value rounded on iPad
history management with page status