Skip to content

Commit

Permalink
ZK-5502: Allow users to customize tooltip on the icon, ZK-5503: Allow…
Browse files Browse the repository at this point in the history
… users to set multiple icons and tooltips on the same LabelImageElement
  • Loading branch information
JamsonChan committed Aug 1, 2023
1 parent a55035f commit aa56083
Show file tree
Hide file tree
Showing 9 changed files with 649 additions and 28 deletions.
2 changes: 2 additions & 0 deletions zkdoc/release-note
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ZK 10.0.0
ZK-5422: Provide some utile APIs to update IComponent Tree
ZK-5215: Support load locale-dependent resources in a relative path
ZK-5142: Handle GET and POST requests more strictly
ZK-5502: Allow users to customize tooltip on the icon
ZK-5503: Allow users to set multiple icons and tooltips on the same LabelImageElement

* Bugs
ZK-5089: AfterSizeEvent doesn't return a correct size of a Window component
Expand Down
137 changes: 137 additions & 0 deletions zktest/src/main/java/org/zkoss/zktest/test2/F100_ZK_5503_Composer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/* F100_ZK_5503_Composer.java
Purpose:
Description:
History:
Thu Jul 27 14:13:48 CST 2023, Created by jamsonchan
Copyright (C) 2023 Potix Corporation. All Rights Reserved.
*/
package org.zkoss.zktest.test2;

import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zkmax.zul.Nav;
import org.zkoss.zkmax.zul.Navitem;
import org.zkoss.zkmax.zul.Orgnode;
import org.zkoss.zul.A;
import org.zkoss.zul.Auxheader;
import org.zkoss.zul.Button;
import org.zkoss.zul.Caption;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Column;
import org.zkoss.zul.Combobutton;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Fileupload;
import org.zkoss.zul.Footer;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listfooter;
import org.zkoss.zul.Listheader;
import org.zkoss.zul.Menu;
import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Toolbarbutton;
import org.zkoss.zul.Treecell;
import org.zkoss.zul.Treecol;
import org.zkoss.zul.Treefooter;
import org.zkoss.zul.impl.LabelImageElement;

public class F100_ZK_5503_Composer extends SelectorComposer {
@Wire
A a;
@Wire
Auxheader auxheader;
@Wire
Column column;
@Wire
Footer footer;
@Wire
Button button;
@Wire
Caption caption;
@Wire
Checkbox checkbox;
@Wire
Combobutton combobutton;
@Wire
Comboitem comboitem;
@Wire
Fileupload fileupload;
@Wire
Listheader listheader;
@Wire
Listcell listcell;
@Wire
Listfooter listfooter;
@Wire
Menu menu;
@Wire
Menuitem menuitem;
@Wire
Nav nav;
@Wire
Navitem navitem;
@Wire
Orgnode orgnode;
@Wire
Radio radio;
@Wire
Tab tab;
@Wire
Toolbarbutton toolbarbutton;
@Wire
Treecol treecol;
@Wire
Treecell treecell;
@Wire
Treefooter treefooter;

@Listen("#test1")
public void test1() {
LabelImageElement[] lies = new LabelImageElement[] {a, auxheader, column, footer, button, caption, checkbox, combobutton, comboitem, fileupload, listheader, listcell, listfooter, menu, menuitem, nav, navitem, orgnode, radio, tab, toolbarbutton, treecol, treecell, treefooter};
for (LabelImageElement lie : lies) {
lie.setIconSclass(new String[]{"z-icon-plus", "z-icon-minus"});
lie.setIconTooltip(new String[]{"1", "1"});
}
}

@Listen("#test2")
public void test2() {
LabelImageElement[] lies = new LabelImageElement[] {a, auxheader, column, footer, button, caption, checkbox, combobutton, comboitem, fileupload, listheader, listcell, listfooter, menu, menuitem, nav, navitem, orgnode, radio, tab, toolbarbutton, treecol, treecell, treefooter};
for (LabelImageElement lie : lies) {
lie.setIconSclass(new String[] {"z-icon-plus", "z-icon-minus"});
lie.setIconTooltip(new String[] {"2"});
}
}

@Listen("#test3")
public void test3() {
LabelImageElement[] lies = new LabelImageElement[] {a, auxheader, column, footer, button, caption, checkbox, combobutton, comboitem, fileupload, listheader, listcell, listfooter, menu, menuitem, nav, navitem, orgnode, radio, tab, toolbarbutton, treecol, treecell, treefooter};
for (LabelImageElement lie : lies) {
lie.setIconSclass(new String[] {"z-icon-plus"});
lie.setIconTooltip(new String[] {"3", "3"});
}
}

@Listen("#test4")
public void test4() {
LabelImageElement[] lies = new LabelImageElement[] {a, auxheader, column, footer, button, caption, checkbox, combobutton, comboitem, fileupload, listheader, listcell, listfooter, menu, menuitem, nav, navitem, orgnode, radio, tab, toolbarbutton, treecol, treecell, treefooter};
for (LabelImageElement lie : lies) {
lie.setIconSclass(new String[] {null, null, null, null, null, null, null});
lie.setIconTooltip(new String[] {null, null, null, null});
}
}

@Listen("#test5")
public void test5() {
LabelImageElement[] lies = new LabelImageElement[] {a, auxheader, column, footer, button, caption, checkbox, combobutton, comboitem, fileupload, listheader, listcell, listfooter, menu, menuitem, nav, navitem, orgnode, radio, tab, toolbarbutton, treecol, treecell, treefooter};
for (LabelImageElement lie : lies) {
lie.setIconSclass(new String[] {"z-icon-plus", null, "z-icon-minus"});
lie.setIconTooltip(new String[] {null, "123", ""});
}
}
}
134 changes: 134 additions & 0 deletions zktest/src/main/webapp/test2/F100-ZK-5502.zul
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
F100-ZK-5502.zul
Purpose:
Description:
History:
Wed Jul 26 14:33:28 CST 2023, Created by jamsonchan
Copyright (C) 2023 Potix Corporation. All Rights Reserved.
-->
<zk xmlns:n="native">

<n:h1>A</n:h1>
<a iconSclass="z-icon-home" iconTooltip="a"/>
<separator/>

<n:h1>AuxHeader / Column / Footer</n:h1>
<grid>
<auxhead>
<auxheader label="auxheader" colspan="1" iconSclass="z-icon-home" iconTooltip="auxheader"/>
</auxhead>
<columns>
<column label="column" iconSclass="z-icon-home" iconTooltip="column"/>
</columns>
<foot>
<footer iconSclass="z-icon-home" iconTooltip="footer">footer</footer>
</foot>
</grid>
<separator/>

<n:h1>Button</n:h1>
<button iconSclass="z-icon-home" iconTooltip="button"/>
<separator/>

<n:h1>Caption</n:h1>
<caption iconSclass="z-icon-home" iconTooltip="caption"/>
<separator/>

<n:h1>CheckBox</n:h1>
<checkbox iconSclass="z-icon-home" iconTooltip="checkbox"/>
<separator/>

<n:h1>ComboButton</n:h1>
<combobutton iconSclass="z-icon-home" iconTooltip="combobutton"/>
<separator/>

<n:h1>ComboItem</n:h1>
<combobox>
<comboitem label="comboitem" iconSclass="z-icon-home" iconTooltip="comboitem"/>
</combobox>
<separator/>

<n:h1>FileUpload</n:h1>
<fileupload label="fileupload" iconSclass="z-icon-home" iconTooltip="fileupload" >
</fileupload>
<separator/>

<n:h1>ListHeader / ListCell / ListFooter</n:h1>
<listbox>
<listhead>
<listheader label="listheader" iconSclass="z-icon-home" iconTooltip="listheader"/>
</listhead>
<listitem>
<listcell label="listcell" iconSclass="z-icon-home" iconTooltip="listcell"/>
</listitem>
<listfoot>
<listfooter label="listfooter" iconSclass="z-icon-home" iconTooltip="listfooter"/>
</listfoot>
</listbox>
<separator/>

<n:h1>Menu / MenuItem</n:h1>
<menubar>
<menu label="menu" iconSclass="z-icon-home" iconTooltip="menu"/>
<menuitem label="menuitem" iconSclass="z-icon-home" iconTooltip="menuitem"/>
</menubar>
<separator/>

<n:h1>Nav / NavItem</n:h1>
<navbar>
<nav label="nav" iconSclass="z-icon-home" iconTooltip="nav"/>
<navitem label="navitem" iconSclass="z-icon-home" iconTooltip="navitem"/>
</navbar>
<separator/>

<n:h1>OrgNode</n:h1>
<organigram>
<orgchildren>
<orgitem>
<orgnode label="orgnode" iconSclass="z-icon-home" iconTooltip="orgnode"/>
</orgitem>
</orgchildren>
</organigram>
<separator/>

<n:h1>Radio</n:h1>
<radio label="radio" iconSclass="z-icon-home" iconTooltip="radio"/>
<separator/>

<n:h1>Tab</n:h1>
<tabbox>
<tabs>
<tab label="tab" iconSclass="z-icon-home" iconTooltip="tab"/>
</tabs>
</tabbox>
<separator/>

<n:h1>ToolBarButton</n:h1>
<toolbar>
<toolbarbutton label="toolbarbutton" iconSclass="z-icon-home" iconTooltip="toolbarbutton"/>
</toolbar>
<separator/>

<n:h1>TreeCol / TreeCell / TreeFooter</n:h1>
<tree>
<treecols>
<treecol label="treecol" iconSclass="z-icon-home" iconTooltip="treecol"/>
</treecols>
<treechildren>
<treeitem>
<treerow>
<treecell label="treecell" iconSclass="z-icon-home" iconTooltip="treecell"/>
</treerow>
</treeitem>
</treechildren>
<treefoot>
<treefooter label="treefooter" iconSclass="z-icon-home" iconTooltip="treefooter"/>
</treefoot>
</tree>
<separator/>
</zk>
Loading

0 comments on commit aa56083

Please sign in to comment.