Upgrade From ZK 6.5"

From Documentation
 
(23 intermediate revisions by 4 users not shown)
Line 7: Line 7:
 
<div style="margin-left: 10px">
 
<div style="margin-left: 10px">
  
== Upgrade Sample ==
+
== Upgrade Example ==
  
In ZK 6.5, the DIV width is '''102px''' if you customize DIV component style as follows:
+
In ZK 6.5, assuming you have specified a DIV with a fixed width, <code>102px</code> including borders (2px) like:
  
 
<source lang="css" highlight="3">
 
<source lang="css" highlight="3">
Line 18: Line 18:
 
</source>
 
</source>
  
However, after upgrading to ZK 7, the DIV width will become '''100px''' since all CSS class names starting with the prefix "''z-''" get ''box-sizing: border-box'' applied by default. If you want to keep the DIV width equal to 102px in ZK 7, modify the original style as follows:
+
However, after upgrading to ZK 7 or above, the DIV width will become '''100px''' since all CSS class names start with the prefix <code>z-</code> get <code>box-sizing: border-box</code> applied by default. If you want to keep the DIV width as 102px in ZK 7, modify the original style as follows:
  
 
<source lang="css" highlight="3">
 
<source lang="css" highlight="3">
Line 36: Line 36:
 
}
 
}
 
</source>
 
</source>
 
</div>
 
  
 
= Tip 2: Component Mold =
 
= Tip 2: Component Mold =
  
Since we drop support the browsers that do not support CSS3 in ZK 7, some components' molds are now sharing the same DOM structure with their default mold to improve performance. However, you do not need to change your Component.setMold() code since ZK handles this transparently.
+
Since we are no longer supporting browsers that don't support CSS 3 in ZK 7, some components' molds are now sharing the same DOM structure with their default mold to improve performance. However, you do not need to change your Component.setMold() code since ZK handles this transparently.
  
 
<div style="margin-left: 10px">
 
<div style="margin-left: 10px">
 
== Upgrade sample ==
 
== Upgrade sample ==
In this [[Small_Talks/2011/December/Customize_Look_and_Feel_of_ZK_Components_Using_CSS3|smalltalk]] we show how to customize the '''button''' component using CSS 3 with the ''os'' mold based on ZK 6.5. Originally the style for an os mold button was overridden using the class ''z-button-os''.
+
In this [[Small_Talks/2011/December/Customize_Look_and_Feel_of_ZK_Components_Using_CSS3|smalltalk]] we showed you how to customize the '''button''' component using CSS 3 with the ''os'' mold based on ZK 6.5. Originally the style for an os mold button was overridden using the class ''z-button-os''.
  
 
<source lang="css" highlight="1">
 
<source lang="css" highlight="1">
Line 55: Line 53:
 
</source>
 
</source>
  
While (in ZK6.5) the button has 2 separate mold implementations (trendy and os), now in ZK7 both molds share the same markup using the same CSS class "z-button" (default mold). Here the new style override:
+
While in ZK 6.5, the button has 2 separate mold implementations (trendy and os), now in ZK7 both molds share the same markup using the same CSS class "z-button" (default mold). Here the new style override:
  
 
<source lang="css" highlight="1">
 
<source lang="css" highlight="1">
Line 67: Line 65:
 
== Brief Summary ==
 
== Brief Summary ==
  
Based on the above, when upgrading from ZK 6.5 to ZK 7.0 it is required to modify the CSS class names (from z-component-mold to z-component) in most situations. Check [[User:Vincent/Upgrade_from_ZK_6.5#Tip 2 Appendix | Tip 2 Appendix]] for the complete list of affected CSS classes.
+
Based on the above, when upgrading from ZK 6.5 to ZK 7.0, it is required to modify the CSS class names (from z-component-mold to z-component) in most situations. Check [[#Tip 2 Appendix | Tip 2 Appendix]] for the complete list of affected components.
  
 
</div>
 
</div>
Line 73: Line 71:
 
= Tip 3: Component Zclass =
 
= Tip 3: Component Zclass =
  
Some components' zclass-es consist of several parts (separated by dashes "-"), for instance, the zclass of the Window component with embedded mode is "''z-window-embedded''" and the CSS class of its header part is "''z-window-embedded-header''". All other modes have corresponding classes following the pattern ''z-window-'''mode'''-header''. In order to make it easy to customize, we separate it into two CSS class with "''zclass modeclass''" pattern.
+
Some components' zclass-es consist of several parts (separated by dashes "-"), for instance, the zclass of the Window component with embedded mode is "''z-window-embedded''" and the CSS class of its header part is "''z-window-embedded-header''". All other modes have corresponding classes following the pattern ''z-window-'''mode'''-header''. In order to make it easier to customize, we separate it into two CSS classes with "''zclass modeclass''" pattern.
  
 
For example,
 
For example,
Line 84: Line 82:
 
</source>
 
</source>
  
Then if you want to customize content part of window for all modes, just simply override CSS class ''z-window-content''.
+
Then, if you want to customize the content part of window for all modes, simply override CSS class ''z-window-content''.
  
 
<div style="margin-left: 10px">
 
<div style="margin-left: 10px">
Line 90: Line 88:
 
== Upgrade sample ==
 
== Upgrade sample ==
  
In this [[Small_Talks/2011/December/Customize_Look_and_Feel_of_ZK_Components_Using_CSS3 | smalltalk]] we show how to customize window component's close icon for all modes as follows:
+
In this [[Small_Talks/2011/December/Customize_Look_and_Feel_of_ZK_Components_Using_CSS3 | smalltalk]] we showed how to customize window component's close icon for all modes as follows:
  
 
<source lang="css">
 
<source lang="css">
Line 122: Line 120:
 
== Brief Summary ==
 
== Brief Summary ==
  
To adapt this change for ZK 7, check [[User:Vincent/Upgrade_from_ZK_6.5#Tip 3 Appendix | Tip 3 Appendix]] for the complete list of related changes eliminating CSS classes.
+
To adapt this change for ZK 7, check [[#Tip 3 Appendix | Tip 3 Appendix]] for the complete list of related changes eliminating CSS classes.
  
 
</div>
 
</div>
Line 128: Line 126:
 
= Tip 4: DOM Structure =
 
= Tip 4: DOM Structure =
  
In ZK 6.5, several components use [[ZK_Style_Guide/XUL_Component_Specification/Button/trendy#Structure|a 3 x 3 grid structure]] to achieve rounded corner style. In ZK 7, we applied CSS 3, therefore, the complex 3 x 3 grid structure is no longer needed.
+
In ZK 6.5, several components use a 3 x 3 grid structure(see image bellow) to achieve the rounded corner style. In ZK 7, we applied CSS 3, therefore, the complex 3 x 3 grid structure is no longer needed.
 +
 
 +
[[Image:Button2.png]]
  
 
<div style="margin-left: 10px">
 
<div style="margin-left: 10px">
Line 134: Line 134:
 
== Upgrade Sample ==
 
== Upgrade Sample ==
  
In this [[Small_Talks/2011/December/Customize_Look_and_Feel_of_ZK_Components_Using_CSS3|smalltalk]] we show how to customize the '''window''' component using CSS 3 based on 3 x 3 grid structure. Originally we had to override several CSS classes (z-component-'''tl''', z-component-'''tm''', z-component-'''tr''', and etc.) to add rounded corners to the window head (line 9).
+
In this [[Small_Talks/2011/December/Customize_Look_and_Feel_of_ZK_Components_Using_CSS3|smalltalk]] we showed how to customize the '''window''' component using CSS 3 based on 3 x 3 grid structure. Originally we had to override several CSS classes (z-component-'''tl''', z-component-'''tm''', z-component-'''tr''', and etc.) to add rounded corners to the window head (line 9).
  
 
<source lang="css" highlight="9">
 
<source lang="css" highlight="9">
Line 180: Line 180:
 
== Brief Summary ==
 
== Brief Summary ==
  
To check the style after we removed 3 x 3 grid structure in ZK 7, we recommended using developer tool provided by browser such as Firebug for FireFox, Developer Tools for Chrome to check new DOM structure first, then move your existing customization style into new CSS class.  Check [[User:Vincent/Upgrade_from_ZK_6.5#Tip 4 Appendix | Tip 4 Appendix]] for the complete list that remove 3 x 3 (or 3x1) grid structure..
+
To check the style after we removed 3 x 3 grid structure in ZK 7, we recommend you to use developer tools provided by browsers such as Firebug for FireFox, Developer Tools for Chrome to check new DOM structure first, then move your existing customization style into the new CSS class.  Check [[#Tip 4 Appendix | Tip 4 Appendix]] for the complete list that removes the 3 x 3 (or 3x1) grid structure..
  
 
</div>
 
</div>
Line 186: Line 186:
 
= Tip 5: CSS Class Naming =
 
= Tip 5: CSS Class Naming =
  
In ZK 6.5, the CSS class names use abbreviation which sometimes hard to understand what it represents. Hence, to make it more semantic in ZK 7, we use full-naming pattern on CSS class names. For example,
+
In ZK 6.5, we use abbreviations for CSS class names which can be hard to understand what it represents sometimes. Hence, to make it more semantic in ZK 7, we use the full-naming pattern on CSS class names. For example,
: ''z-component-'''ver''''' become ''z-component-'''vertical''''',
+
 
: ''z-component-'''cnt''''' become ''z-component-'''content''''',
+
{| class='wikitable' | width="100%"
: ''z-component-'''seld''''' become ''z-component-'''selected''''',
+
! <center>6.5</center>
: ''z-component'''-over''''' become ''z-component''':hover''''', or
+
! <center>7.0</center>
: ''z-component'''-disd''''' become ''z-component'''[disabled]'''''
+
|-
 +
| z-component-'''ver'''
 +
| z-component-'''vertical'''
 +
|-
 +
| z-component-'''cnt'''
 +
| z-component-'''content'''
 +
|-
 +
| z-component-'''seld'''
 +
| z-component-'''selected'''
 +
|-
 +
| z-component'''-over'''
 +
| z-component''':hover'''
 +
|-
 +
| z-component'''-disd'''''  
 +
| z-component'''[disabled]'''
 +
|}
  
Here we can see not only change abbreviation to full name, but also use CSS selector like ''':hover''' and attribute selector like '''[disabled]''' to make it more intuitive.
 
  
<div style="margin-left:10px">
+
Here we can see not only abbreviations have been changed to full names, but we also use CSS selectors like''':hover''' and the attribute selector like '''[disabled]''' to make it more intuitive.
 +
 
  
 
== Upgrade Sample ==
 
== Upgrade Sample ==
  
In this [[Small_Talks/2012/March/Customize_Look_and_Feel_of_ZK_Components_Using_CSS3_-_Part_2 | smalltalk]] we demonstrate how to customize comboitem style when it is selected by override CSS class ''z-comboitem-seld'' in ZK 6.5 as follows:
+
In this [[Small_Talks/2012/March/Customize_Look_and_Feel_of_ZK_Components_Using_CSS3_-_Part_2 | smalltalk]] we demonstrate how to customize comboitem style when it is selected by overriding CSS class ''z-comboitem-seld'' in ZK 6.5 as follows:
  
 
<source lang="css" highlight="2">
 
<source lang="css" highlight="2">
Line 221: Line 236:
 
== Brief Summary ==
 
== Brief Summary ==
  
In most situation, upgrade to ZK 7.0 from ZK 6.5 based on this change is to modify CSS class name with full naming pattern (from z-component-''shortname'' to z-component-''fullname''). Check [[User:Vincent/Upgrade_from_ZK_6.5#Tip 5 Appendix | Tip 5 Appendix]] for the complete list of ZK 7 CSS class naming rule.
+
In most situations, to upgrade to ZK 7.0 from ZK 6.5 based on these changes is to modify CSS class names with full naming patterns (from z-component-''shortname'' to z-component-''fullname''). Check [[#Tip 5 Appendix | Tip 5 Appendix]] for the complete list of ZK 7 CSS class naming rule.
  
 
</div>
 
</div>
Line 227: Line 242:
 
= Tip 6: Image Icons and Font Icons =
 
= Tip 6: Image Icons and Font Icons =
  
In order to reduce page loading time, we use font icons in ZK 7 to replace original image icons. There are a lot of web icon fonts, in ZK 7 we integrate [http://fortawesome.github.io/Font-Awesome/ Font Awesome 4.0.1] together. Thus, it is easy to use font icons in ZK application by simply replace prefix '''fa''' to '''z-icon''', for example, ''z-icon-caret-up'' represents a [http://fortawesome.github.io/Font-Awesome/icon/caret-up/ triangle arrow up] font icon.
+
In order to reduce page loading time, we use font icons in ZK 7 to replace original image icons. There are a lot of web icon fonts on the market, here we integrate in ZK 7 with [http://fortawesome.github.io/Font-Awesome/ Font Awesome 4.0.1]. Thus, it is easy to use font icons in ZK application by simply replace prefix '''fa''' to '''z-icon''', for example, ''z-icon-caret-up'' represents a [http://fortawesome.github.io/Font-Awesome/icon/caret-up/ triangle arrow up] font icon.
  
 
<div style="margin-left:10px">
 
<div style="margin-left:10px">
Line 241: Line 256:
 
</source>
 
</source>
  
However, after upgrade to ZK 7, you can see not only the image showed but also the font icon that ZK 7 used by default. To disable the font icon you can override font icon CSS class as follows:
+
However, after upgrade to ZK 7, you can see not only the image showed, the font icon that ZK 7 uses by default also shows up. To disable the font icon you can override the font icon CSS class as follows:
  
 
<source lang="css" highlight="4,5,6">
 
<source lang="css" highlight="4,5,6">
Line 267: Line 282:
 
= Tip 7: Scrollbar =
 
= Tip 7: Scrollbar =
  
Since ZK 7, we provide custom scrollbar for Grid, Listbox and Tree component by default. Which means you can also customize scrollbar style. Here we will demonstrate how to style it. Or if you do not like custom scrollbar, we will also demonstrate how to disable it and using browser default scrollbar instead.
+
Since ZK 7, we provide custom scrollbar for Grid, Listbox and Tree component by default, which means you can also customize scrollbar style. Here we will demonstrate how to style it. Or, if you do not wish to custom your scrollbar, we will also demonstrate how to disable it and use browser default scrollbar instead.
  
 
<div style="margin-left:10px">
 
<div style="margin-left:10px">
Line 273: Line 288:
 
== Customize Scrollbar Style ==
 
== Customize Scrollbar Style ==
  
The custom scrollbar is consists of two buttons to click for scrolling left/right, an indicator to represent current scroll position and a rail to slide indicator. Therefore, we need to override CSS class as follows:
+
The custom scrollbar consists of two buttons to click for scrolling left/right, an indicator to represent current scroll position and a rail to slide indicator. Therefore, we need to override CSS class as follows:
  
 
<source lang="css" highlight="2,6,11,17,21">
 
<source lang="css" highlight="2,6,11,17,21">
Line 301: Line 316:
 
</source>
 
</source>
  
Then you can check the customization result.
+
You can check the customized result.
  
 
<gallery widths="310px" heights="20px">
 
<gallery widths="310px" heights="20px">
Line 318: Line 333:
 
</library-property>
 
</library-property>
 
</source>
 
</source>
 +
'''Note''': the value of org.zkoss.zul.nativebar is true by default (since 7.0.2)
  
</div>
+
= Tip 2 Appendix =
 +
 
 +
{| class='wikitable'
 +
|-
 +
!  | Component
 +
!  | ZK 6.5 mold
 +
!  | ZK 7 mold
 +
|-
 +
|  | Button
 +
|  | os <br/> trendy
 +
|  | default
 +
|-
 +
|  |
 +
Textbox <br/>
 +
Intbox <br/>
 +
Decimalbox <br/>
 +
Longbox <br/>
 +
Doublebox <br/>
 +
Combobox <br/>
 +
Bandbox <br/>
 +
Datebox <br/>
 +
Timebox <br/>
 +
Spinner <br/>
 +
Doublespinner
 +
|  | default <br/> rounded
 +
|  | default
 +
|-
 +
|  | Splitter
 +
|  | default <br/> os
 +
|  | default
 +
|-
 +
|  | Tabbox
 +
|  | accordion <br/> accordion-lite
 +
|  | accordion
 +
|}
  
 
= Tip 2 Appendix =
 
= Tip 2 Appendix =
  
{| style="margin-top: 10px;"
+
{| class='wikitable'
 
|-
 
|-
! style="border: 1px inset #333333; padding: 0 4px;" | Component  
+
! | Component  
! style="border: 1px inset #333333; padding: 0 4px;" | ZK 6.5 mold
+
! | ZK 6.5 mold
! style="border: 1px inset #333333; padding: 0 4px;" | ZK 7 mold
+
! | ZK 7 mold
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Button
+
| | Button
| style="border: 1px inset #333333; padding: 0 4px;" | os <br/> trendy
+
| | os <br/> trendy
| style="border: 1px inset #333333; padding: 0 4px;" | default
+
| | default
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
Textbox <br/>
 
Textbox <br/>
 
Intbox <br/>
 
Intbox <br/>
Line 345: Line 395:
 
Spinner <br/>
 
Spinner <br/>
 
Doublespinner
 
Doublespinner
| style="border: 1px inset #333333; padding: 0 4px;" | default <br/> rounded
+
| | default <br/> rounded
| style="border: 1px inset #333333; padding: 0 4px;" | default
+
| | default
 +
|-
 +
|  | Splitter
 +
|  | default <br/> os
 +
|  | default
 +
|-
 +
|  | Tabbox
 +
|  | accordion <br/> accordion-lite
 +
|  | accordion
 +
|}
 +
= Tip 3 Appendix =
 +
 
 +
{| class='wikitable'
 +
|-
 +
! | Component
 +
! | ZK 6.5 sample
 +
! | ZK 7 sample
 +
|-
 +
| | Splitter
 +
| |
 +
z-splitter-hor <br/>
 +
z-splitter-ver
 +
| |
 +
z-splitter z-splitter-horizontal <br/>
 +
z-splitter z-splitter-vertical
 +
|-
 +
| | Slider
 +
| |
 +
z-slider-hor <br/>
 +
z-slider-ver
 +
| |
 +
z-slider z-slider-horizontal <br/>
 +
z-slider z-slider-vertical
 +
|-
 +
| | Menubar
 +
| |
 +
z-menubar-hor <br/>
 +
z-menubar-ver
 +
| |
 +
z-menubar z-menubar-horizontal <br/>
 +
z-menubar z-menubar-vertical
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Splitter
+
| | Toolbar
| style="border: 1px inset #333333; padding: 0 4px;" | default <br/> os
+
| | z-toolbar-tabs
| style="border: 1px inset #333333; padding: 0 4px;" | default
+
| | z-toolbar z-toolbar-tabs
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Tabbox
+
| | Combobutton
| style="border: 1px inset #333333; padding: 0 4px;" | accordion <br/> accordion-lite
+
| | z-combobutton-toolbar
| style="border: 1px inset #333333; padding: 0 4px;" | accordion
+
| | z-combobutton z-combobutton-toolbar
 +
|-
 +
| | Separator
 +
| |
 +
z-separator-horizontal <br/>
 +
z-separator-vertical
 +
| |
 +
z-separator z-separator-horizontal <br/>
 +
z-separator z-separator-vertical
 +
|-
 +
| | Groupbox
 +
| |
 +
z-groupbox-3d
 +
| |
 +
z-groupbox z-groupbox-3d
 +
|-
 +
| | Tabbox
 +
| |  
 +
z-tabbox <br/><br/>
 +
z-tabbox-ver <br/><br/>
 +
z-tabbox-accordion
 +
| |
 +
z-tabbox z-tabbox-top <br/>
 +
z-tabbox z-tabbox-bottom <br/>
 +
z-tabbox z-tabbox-left <br/>
 +
z-tabbox z-tabbox-right <br/>
 +
z-tabbox z-tabbox-accordion
 +
|-
 +
| | Window
 +
| |
 +
z-window-embedded <br/>
 +
z-window-modal <br/>
 +
z-window-highlighted <br/>
 +
z-window-overlapped <br/>
 +
z-window-popup
 +
| |  
 +
z-window z-window-embedded <br/>
 +
z-window z-window-modal <br/>
 +
z-window z-window-highlighted <br/>
 +
z-window z-window-overlapped <br/>
 +
z-window z-window-popup
 
|}
 
|}
  
 +
= Tip 2 Appendix =
 +
 +
{| class='wikitable'
 +
|-
 +
!  | Component
 +
!  | ZK 6.5 mold
 +
!  | ZK 7 mold
 +
|-
 +
|  | Button
 +
|  | os <br/> trendy
 +
|  | default
 +
|-
 +
|  |
 +
Textbox <br/>
 +
Intbox <br/>
 +
Decimalbox <br/>
 +
Longbox <br/>
 +
Doublebox <br/>
 +
Combobox <br/>
 +
Bandbox <br/>
 +
Datebox <br/>
 +
Timebox <br/>
 +
Spinner <br/>
 +
Doublespinner
 +
|  | default <br/> rounded
 +
|  | default
 +
|-
 +
|  | Splitter
 +
|  | default <br/> os
 +
|  | default
 +
|-
 +
|  | Tabbox
 +
|  | accordion <br/> accordion-lite
 +
|  | accordion
 +
|}
 
= Tip 3 Appendix =
 
= Tip 3 Appendix =
  
{| style="margin-top: 10px;"
+
{| class='wikitable'
 
|-
 
|-
! style="border: 1px inset #333333; padding: 0 4px;" | Component  
+
! | Component  
! style="border: 1px inset #333333; padding: 0 4px;" | ZK 6.5 sample
+
! | ZK 6.5 sample
! style="border: 1px inset #333333; padding: 0 4px;" | ZK 7 sample
+
! | ZK 7 sample
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Splitter
+
| | Splitter
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-splitter-hor <br/>
 
z-splitter-hor <br/>
 
z-splitter-ver
 
z-splitter-ver
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-splitter z-splitter-horizontal <br/>
 
z-splitter z-splitter-horizontal <br/>
 
z-splitter z-splitter-vertical
 
z-splitter z-splitter-vertical
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Slider
+
| | Slider
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-slider-hor <br/>
 
z-slider-hor <br/>
 
z-slider-ver
 
z-slider-ver
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-slider z-slider-horizontal <br/>
 
z-slider z-slider-horizontal <br/>
 
z-slider z-slider-vertical
 
z-slider z-slider-vertical
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Menubar
+
| | Menubar
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-menubar-hor <br/>
 
z-menubar-hor <br/>
 
z-menubar-ver
 
z-menubar-ver
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-menubar z-menubar-horizontal <br/>
 
z-menubar z-menubar-horizontal <br/>
 
z-menubar z-menubar-vertical
 
z-menubar z-menubar-vertical
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Toolbar
+
| | Toolbar
| style="border: 1px inset #333333; padding: 0 4px;" | z-toolbar-tabs
+
| | z-toolbar-tabs
| style="border: 1px inset #333333; padding: 0 4px;" | z-toolbar z-toolbar-tabs
+
| | z-toolbar z-toolbar-tabs
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Combobutton
+
| | Combobutton
| style="border: 1px inset #333333; padding: 0 4px;" | z-combobutton-toolbar
+
| | z-combobutton-toolbar
| style="border: 1px inset #333333; padding: 0 4px;" | z-combobutton z-combobutton-toolbar
+
| | z-combobutton z-combobutton-toolbar
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Separator
+
| | Separator
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-separator-horizontal <br/>
 
z-separator-horizontal <br/>
 
z-separator-vertical
 
z-separator-vertical
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-separator z-separator-horizontal <br/>
 
z-separator z-separator-horizontal <br/>
 
z-separator z-separator-vertical
 
z-separator z-separator-vertical
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Groupbox
+
| | Groupbox
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-groupbox-3d
 
z-groupbox-3d
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-groupbox z-groupbox-3d
 
z-groupbox z-groupbox-3d
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Tabbox
+
| | Tabbox
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-tabbox <br/><br/>
 
z-tabbox <br/><br/>
 
z-tabbox-ver <br/><br/>
 
z-tabbox-ver <br/><br/>
 
z-tabbox-accordion
 
z-tabbox-accordion
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
z-tabbox z-tabbox-horizontal <br/>
+
z-tabbox z-tabbox-top <br/>
z-tabbox z-tabbox-horizontal-bottom <br/>
+
z-tabbox z-tabbox-bottom <br/>
z-tabbox z-tabbox-vertical <br/>
+
z-tabbox z-tabbox-left <br/>
z-tabbox z-tabbox-vertical-right <br/>
+
z-tabbox z-tabbox-right <br/>
 
z-tabbox z-tabbox-accordion
 
z-tabbox z-tabbox-accordion
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | Window
+
| | Window
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-window-embedded <br/>
 
z-window-embedded <br/>
 
z-window-modal <br/>
 
z-window-modal <br/>
Line 430: Line 595:
 
z-window-overlapped <br/>
 
z-window-overlapped <br/>
 
z-window-popup
 
z-window-popup
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
z-window z-window-embedded <br/>
 
z-window z-window-embedded <br/>
 
z-window z-window-modal <br/>
 
z-window z-window-modal <br/>
Line 437: Line 602:
 
z-window z-window-popup
 
z-window z-window-popup
 
|}
 
|}
 
 
= Tip 4 Appendix =
 
= Tip 4 Appendix =
  
{| style="margin-top: 10px;"
+
{| class='wikitable'
 
|-
 
|-
! style="border: 1px inset #333333; padding: 0 4px;" | Component  
+
! | Component  
! style="border: 1px inset #333333; padding: 0 4px;" | ZK 6.5 DOM structure
+
! | ZK 6.5 DOM structure
! style="border: 1px inset #333333; padding: 0 4px;" | ZK 7 DOM structure
+
! | ZK 7 DOM structure
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
Button
 
Button
| style="border: 1px inset #333333; padding: 0 4px;" | Trendy mold
+
| | Trendy mold
 
<source lang="html">
 
<source lang="html">
 
<span class="z-button">
 
<span class="z-button">
Line 471: Line 635:
 
</span>
 
</span>
 
</source>
 
</source>
| style="border: 1px inset #333333; padding: 0 4px;" |
+
| |
 
<source lang="html">
 
<source lang="html">
 
<button class="z-button" />
 
<button class="z-button" />
 
</source>
 
</source>
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
Caption
 
Caption
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<table class="z-caption">
 
<table class="z-caption">
Line 487: Line 651:
 
</table>
 
</table>
 
</source>
 
</source>
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<div class="z-caption">
 
<div class="z-caption">
Line 494: Line 658:
 
</source>
 
</source>
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
Combobutton
 
Combobutton
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<span class="z-combobutton">
 
<span class="z-combobutton">
Line 523: Line 687:
 
</span>
 
</span>
 
</source>
 
</source>
| style="border: 1px inset #333333; padding: 0 4px;" |
+
| |
 
<source lang="html">
 
<source lang="html">
 
<span class="z-combobutton">
 
<span class="z-combobutton">
Line 535: Line 699:
 
</source>
 
</source>
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
Textbox <br/>
 
Textbox <br/>
 
Intbox <br/>
 
Intbox <br/>
Line 541: Line 705:
 
Longbox <br/>
 
Longbox <br/>
 
Doublebox
 
Doublebox
| style="border: 1px inset #333333; padding: 0 4px;" | rounded mold
+
| | rounded mold
 
<source lang="html">
 
<source lang="html">
 
<i class="z-component-rounded">
 
<i class="z-component-rounded">
Line 548: Line 712:
 
</i>
 
</i>
 
</source>
 
</source>
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<input class="z-component" />
 
<input class="z-component" />
 
</source>
 
</source>
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
Groupbox
 
Groupbox
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<div class="z-groupbox">
 
<div class="z-groupbox">
Line 571: Line 735:
 
</div>
 
</div>
 
</source>
 
</source>
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<div class="z-groupbox">
 
<div class="z-groupbox">
Line 579: Line 743:
 
</source>
 
</source>
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
Panel
 
Panel
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<div class="z-panel">
 
<div class="z-panel">
Line 613: Line 777:
 
</div>
 
</div>
 
</source>
 
</source>
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<div class="z-panel">
 
<div class="z-panel">
Line 625: Line 789:
 
</source>
 
</source>
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
Window
 
Window
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<div class="z-window">
 
<div class="z-window">
Line 652: Line 816:
 
</div>
 
</div>
 
</source>
 
</source>
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<div class="z-window">
 
<div class="z-window">
Line 660: Line 824:
 
</source>
 
</source>
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
Tab
 
Tab
| style="border: 1px inset #333333; padding: 0 4px;" | horizontal / vertical orient  
+
| | horizontal / vertical orient  
 
<source lang="html">
 
<source lang="html">
 
<li class="z-tab">
 
<li class="z-tab">
Line 673: Line 837:
 
</li>
 
</li>
 
</source>
 
</source>
| style="border: 1px inset #333333; padding: 0 4px;" |  
+
| |  
 
<source lang="html">
 
<source lang="html">
 
<li class="z-tab">
 
<li class="z-tab">
Line 686: Line 850:
 
= Tip 5 Appendix =
 
= Tip 5 Appendix =
  
{| style="margin-top: 10px"
+
{| class='wikitable'
 
|-
 
|-
! style="border: 1px inset #333333; padding: 0 4px;" | Category
+
! | Category
! style="border: 1px inset #333333; padding: 0 4px;" | ZK 6.5 class name
+
! | ZK 6.5 class name
! style="border: 1px inset #333333; padding: 0 4px;" | ZK 7 class name
+
! | ZK 7 class name
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" rowspan="9" | Layout Elements
+
| rowspan="9" | Layout Elements
| style="border: 1px inset #333333; padding: 0 4px;" | -outer
+
| | -outer
| style="border: 1px inset #333333; padding: 0 4px;" | -outer
+
| | -outer
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -body
+
| | -body
| style="border: 1px inset #333333; padding: 0 4px;" | -body
+
| | -body
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -header
+
| | -header
| style="border: 1px inset #333333; padding: 0 4px;" | -header
+
| | -header
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -inner
+
| | -inner
| style="border: 1px inset #333333; padding: 0 4px;" | -inner
+
| | -inner
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -cnt
+
| | '''-cnt'''
| style="border: 1px inset #333333; padding: 0 4px;" | -content
+
| | -content
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -footer
+
| | -footer
| style="border: 1px inset #333333; padding: 0 4px;" | -footer
+
| | -footer
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -noheader
+
| | -noheader
| style="border: 1px inset #333333; padding: 0 4px;" | -noheader
+
| | -noheader
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -noborder
+
| | -noborder
| style="border: 1px inset #333333; padding: 0 4px;" | -noborder
+
| | -noborder
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -nofooter
+
| | '''-nofooter'''
| style="border: 1px inset #333333; padding: 0 4px;" | ''deprecated''*
+
| | ''deprecated''*
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" rowspan="8" | Other Elements
+
| rowspan="8" | Other Elements
| style="border: 1px inset #333333; padding: 0 4px;" | -faker
+
| | -faker
| style="border: 1px inset #333333; padding: 0 4px;" | -faker
+
| | -faker
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -text
+
| | -text
| style="border: 1px inset #333333; padding: 0 4px;" | -text
+
| | -text
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -inp
+
| | '''-inp'''
| style="border: 1px inset #333333; padding: 0 4px;" | -input
+
| | -input
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -sep
+
| | '''-sep'''
| style="border: 1px inset #333333; padding: 0 4px;" | -separator
+
| | -separator
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" rowspan="2" | -img
+
| rowspan="2" | -img
| style="border: 1px inset #333333; padding: 0 4px;" | -image (for comoponent's API, such as Button.setImage())
+
| | -image (for comoponent's API, such as Button.setImage())
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -icon (for comopnent's interaction, such as drop-down button on combobox)
+
| | -icon (for comopnent's interaction, such as drop-down button on combobox)
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -pp
+
| | '''-pp'''
| style="border: 1px inset #333333; padding: 0 4px;" | -popup
+
| | -popup
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -btn
+
| | '''-btn'''
| style="border: 1px inset #333333; padding: 0 4px;" | -button
+
| | -button
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" rowspan="5" | Switch Icons
+
| rowspan="5" | Switch Icons
| style="border: 1px inset #333333; padding: 0 4px;" | -close
+
| | -close
| style="border: 1px inset #333333; padding: 0 4px;" | -close
+
| | -close
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -colps
+
| | '''-colps'''
| style="border: 1px inset #333333; padding: 0 4px;" | -collapse
+
| | -collapse
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -colpsd
+
| | '''-colpsd'''
| style="border: 1px inset #333333; padding: 0 4px;" | -collapsed
+
| | -collapsed
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -exp
+
| | '''-exp'''
| style="border: 1px inset #333333; padding: 0 4px;" | -expand
+
| | -expand
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -expd
+
| | '''-expd'''
| style="border: 1px inset #333333; padding: 0 4px;" | -expanded
+
| | -expanded
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" rowspan="4" | Resize Icons
+
| rowspan="4" | Resize Icons
| style="border: 1px inset #333333; padding: 0 4px;" | -max
+
| | '''-max'''
| style="border: 1px inset #333333; padding: 0 4px;" | -maximize
+
| | -maximize
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -maxd
+
| | '''-maxd'''
| style="border: 1px inset #333333; padding: 0 4px;" | -maximized
+
| | -maximized
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -min
+
| | '''-min'''
| style="border: 1px inset #333333; padding: 0 4px;" | -minimize
+
| | -minimize
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -mind
+
| | '''-mind'''
| style="border: 1px inset #333333; padding: 0 4px;" | ''deprecated''*
+
| | ''deprecated''*
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" rowspan="2" | Split Icons
+
| rowspan="2" | Split Icons
| style="border: 1px inset #333333; padding: 0 4px;" | -splt
+
| | '''-splt'''
| style="border: 1px inset #333333; padding: 0 4px;" | -splitter
+
| | -splitter
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -ns
+
| | -ns
| style="border: 1px inset #333333; padding: 0 4px;" | -nosplitter
+
| | -nosplitter
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" rowspan="5" | Orient and Position
+
| rowspan="5" | Orient and Position
| style="border: 1px inset #333333; padding: 0 4px;" | -ver
+
| | '''-ver'''
| style="border: 1px inset #333333; padding: 0 4px;" | -vertical
+
| | -vertical
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -hor
+
| | '''-hor'''
| style="border: 1px inset #333333; padding: 0 4px;" | -horizontal
+
| | -horizontal
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -start
+
| | -start
| style="border: 1px inset #333333; padding: 0 4px;" | -start
+
| | -start
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -center
+
| | -center
| style="border: 1px inset #333333; padding: 0 4px;" | -center
+
| | -center
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -end
+
| | -end
| style="border: 1px inset #333333; padding: 0 4px;" | -end
+
| | -end
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" rowspan="13" | Event Effect
+
| rowspan="13" | Event Effect
| style="border: 1px inset #333333; padding: 0 4px;" | -clk
+
| | '''-clk'''
| style="border: 1px inset #333333; padding: 0 4px;" | :active or -click
+
| | :active or -click
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -focus
+
| | -focus
| style="border: 1px inset #333333; padding: 0 4px;" | :focus or -focus
+
| | :focus or -focus
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -over
+
| | '''-over'''
| style="border: 1px inset #333333; padding: 0 4px;" | :hover or -hover
+
| | :hover or -hover
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -drag
+
| | -drag
| style="border: 1px inset #333333; padding: 0 4px;" | -drag
+
| | -drag
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -drop
+
| | '''-drop'''
| style="border: 1px inset #333333; padding: 0 4px;" | ''deprecated''*
+
| | ''deprecated''*
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -seld
+
| | '''-seld'''
| style="border: 1px inset #333333; padding: 0 4px;" | -selected
+
| | -selected
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -ck
+
| | '''-ck'''
| style="border: 1px inset #333333; padding: 0 4px;" | -checked
+
| | -checked
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -unck
+
| | '''-unck'''
| style="border: 1px inset #333333; padding: 0 4px;" | -unchecked
+
| | -unchecked
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -disd
+
| | '''-disd'''
| style="border: 1px inset #333333; padding: 0 4px;" | [disabled] or -disabled
+
| | [disabled] or -disabled
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -visi
+
| | '''-visi'''
| style="border: 1px inset #333333; padding: 0 4px;" | :visited or -visited
+
| | :visited or -visited
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -hide
+
| | '''-hide'''
| style="border: 1px inset #333333; padding: 0 4px;" | ''deprecated''*
+
| | ''deprecated''*
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -invalid
+
| | -invalid
| style="border: 1px inset #333333; padding: 0 4px;" | -invalid
+
| | -invalid
 
|-
 
|-
| style="border: 1px inset #333333; padding: 0 4px;" | -readonly
+
| | -readonly
| style="border: 1px inset #333333; padding: 0 4px;" | [readonly] or -readonly
+
| | [readonly] or -readonly
 
|}
 
|}
* deprecated means it is never used
+
* deprecated means it is never used in 7.0
  
=Version History=
 
{{LastUpdated}}
 
{| border="1px" | width="100%"
 
! Version !! Date !! Content
 
|-
 
| &nbsp;
 
| &nbsp;
 
| &nbsp;
 
|}
 
  
 
{{ZKStyleCustomizationGuidePageFooter}}
 
{{ZKStyleCustomizationGuidePageFooter}}

Latest revision as of 02:44, 22 September 2023


Tip 1: Box Sizing

To improve performance at client side, we use the border-box model for all components in ZK 7 instead of the content-box model. It means a specified CSS property - width/min-width and height/min-height - on the element will consider border width.

Upgrade Example

In ZK 6.5, assuming you have specified a DIV with a fixed width, 102px including borders (2px) like:

.z-div {
    border: 1px solid #000000;
    width: 100px;
}

However, after upgrading to ZK 7 or above, the DIV width will become 100px since all CSS class names start with the prefix z- get box-sizing: border-box applied by default. If you want to keep the DIV width as 102px in ZK 7, modify the original style as follows:

.z-div {
    border: 1px solid #000000;
    width: 102px;
}

or

.z-div {
    border: 1px solid #000000;
    width: 100px;
    box-sizing: content-box;
}

Tip 2: Component Mold

Since we are no longer supporting browsers that don't support CSS 3 in ZK 7, some components' molds are now sharing the same DOM structure with their default mold to improve performance. However, you do not need to change your Component.setMold() code since ZK handles this transparently.

Upgrade sample

In this smalltalk we showed you how to customize the button component using CSS 3 with the os mold based on ZK 6.5. Originally the style for an os mold button was overridden using the class z-button-os.

.z-button-os {
    color: #FFFFFF;
    font-weight: bold;
    /* omitted */
}

While in ZK 6.5, the button has 2 separate mold implementations (trendy and os), now in ZK7 both molds share the same markup using the same CSS class "z-button" (default mold). Here the new style override:

.z-button {
    color: #FFFFFF;
    font-weight: bold;
    /* omitted */
}

Brief Summary

Based on the above, when upgrading from ZK 6.5 to ZK 7.0, it is required to modify the CSS class names (from z-component-mold to z-component) in most situations. Check Tip 2 Appendix for the complete list of affected components.

Tip 3: Component Zclass

Some components' zclass-es consist of several parts (separated by dashes "-"), for instance, the zclass of the Window component with embedded mode is "z-window-embedded" and the CSS class of its header part is "z-window-embedded-header". All other modes have corresponding classes following the pattern z-window-mode-header. In order to make it easier to customize, we separate it into two CSS classes with "zclass modeclass" pattern.

For example,

<div class="z-window z-window-embedded">
    <div class="z-window-header"></div>
    <div class="z-window-content"></div>
</div>

Then, if you want to customize the content part of window for all modes, simply override CSS class z-window-content.

Upgrade sample

In this smalltalk we showed how to customize window component's close icon for all modes as follows:

.z-window-embedded-close,
.z-window-overlapped-close,
.z-window-popup-close,
.z-window-highlighted-close,
.z-window-modal-close {
	background: url('../img/wnd-icon.png') no-repeat scroll 0 0;
}
.z-window-embedded-close-over,
.z-window-overlapped-close-over,
.z-window-popup-close-over,
.z-window-highlighted-close-over,
.z-window-modal-close-over {
	background: url('../img/wnd-icon.png') no-repeat scroll 0 -16px;
}

In ZK 7, you can remove -mode part for all modes.

.z-window-close {
	background: url('../img/wnd-icon.png') no-repeat scroll 0 0;
}
.z-window-close:hover {
	background: url('../img/wnd-icon.png') no-repeat scroll 0 -16px;
}

Brief Summary

To adapt this change for ZK 7, check Tip 3 Appendix for the complete list of related changes eliminating CSS classes.

Tip 4: DOM Structure

In ZK 6.5, several components use a 3 x 3 grid structure(see image bellow) to achieve the rounded corner style. In ZK 7, we applied CSS 3, therefore, the complex 3 x 3 grid structure is no longer needed.

Button2.png

Upgrade Sample

In this smalltalk we showed how to customize the window component using CSS 3 based on 3 x 3 grid structure. Originally we had to override several CSS classes (z-component-tl, z-component-tm, z-component-tr, and etc.) to add rounded corners to the window head (line 9).

.z-window-embedded-tl,
.z-window-embedded-tm,
.z-window-embedded-tr {
    /* omitted */
}
.z-window-embedded-hl,
.z-window-embedded-hm,
.z-window-embedded-hr {
    border-radius: 4px 4px 0 0;
    /* omitted */
}
.z-window-embedded-cl,
.z-window-embedded-cm,
.z-window-embedded-cr {
    /* omitted */
}
.z-window-embedded-bl,
.z-window-embedded-bm,
.z-window-embedded-br {
    /* omitted */
}

In ZK 7, the DOM structure of the window component is simplified.

<div class="z-window">
    <div class="z-window-header"></div>
    <div class="z-window-content"></div>
</div>

Therefore, it is sufficient to just override the z-window class, to add rounded corners:

.z-window {
    border-radius: 4px 4px 0 0;
    /* omitted */
}

Brief Summary

To check the style after we removed 3 x 3 grid structure in ZK 7, we recommend you to use developer tools provided by browsers such as Firebug for FireFox, Developer Tools for Chrome to check new DOM structure first, then move your existing customization style into the new CSS class. Check Tip 4 Appendix for the complete list that removes the 3 x 3 (or 3x1) grid structure..

Tip 5: CSS Class Naming

In ZK 6.5, we use abbreviations for CSS class names which can be hard to understand what it represents sometimes. Hence, to make it more semantic in ZK 7, we use the full-naming pattern on CSS class names. For example,

6.5
7.0
z-component-ver z-component-vertical
z-component-cnt z-component-content
z-component-seld z-component-selected
z-component-over z-component:hover
z-component-disd z-component[disabled]


Here we can see not only abbreviations have been changed to full names, but we also use CSS selectors like:hover and the attribute selector like [disabled] to make it more intuitive.


Upgrade Sample

In this smalltalk we demonstrate how to customize comboitem style when it is selected by overriding CSS class z-comboitem-seld in ZK 6.5 as follows:

.z-combobox-pp .z-comboitem-over,
.z-combobox-pp .z-comboitem-seld {
    color: #2BCCDA;
    background-color: #000000;
}

In ZK 7, the CSS class name is change to full name z-comboitem-selected, therefore, you have to modify it as follows:

.z-combobox-popup .z-comboitem:hover,
.z-combobox-popup .z-comboitem-selected {
    color: #2BCCDA;
    background-color: #000000;
}

Brief Summary

In most situations, to upgrade to ZK 7.0 from ZK 6.5 based on these changes is to modify CSS class names with full naming patterns (from z-component-shortname to z-component-fullname). Check Tip 5 Appendix for the complete list of ZK 7 CSS class naming rule.

Tip 6: Image Icons and Font Icons

In order to reduce page loading time, we use font icons in ZK 7 to replace original image icons. There are a lot of web icon fonts on the market, here we integrate in ZK 7 with Font Awesome 4.0.1. Thus, it is easy to use font icons in ZK application by simply replace prefix fa to z-icon, for example, z-icon-caret-up represents a triangle arrow up font icon.

Upgrade Sample

In this smalltalk, we customize combobox button with custom image as follows:

.z-combobox-btn {
    background: url('../img/combo-btn.png') no-repeat;
}

However, after upgrade to ZK 7, you can see not only the image showed, the font icon that ZK 7 uses by default also shows up. To disable the font icon you can override the font icon CSS class as follows:

.z-combobox-button {
    background: url('../img/combo-btn.png') no-repeat;
}
.z-combobox-icon {
	display: none;
}

or

.z-combobox-button {
    background: url('../img/combo-btn.png') no-repeat;
}
.z-combobox-icon.z-icon-caret-down:before {
	content: '';
}

Tip 7: Scrollbar

Since ZK 7, we provide custom scrollbar for Grid, Listbox and Tree component by default, which means you can also customize scrollbar style. Here we will demonstrate how to style it. Or, if you do not wish to custom your scrollbar, we will also demonstrate how to disable it and use browser default scrollbar instead.

Customize Scrollbar Style

The custom scrollbar consists of two buttons to click for scrolling left/right, an indicator to represent current scroll position and a rail to slide indicator. Therefore, we need to override CSS class as follows:

/* Two buttons to click for scrolling left/right */
.z-scrollbar-left, .z-scrollbar-right {
    background: #FFFFFF;
    color: #3AA4C3;
}
.z-scrollbar-left:hover, .z-scrollbar-right:hover {
	background: #3AA4C3;
	color: #FFFFFF;
}
/* An indicator to represent current scroll position */
.z-scrollbar-horizontal .z-scrollbar-indicator {
    background: #3AA4C3;
    border: none;
    top: 2px;
}
/* A rail to slide indicator */
.z-scrollbar-horizontal .z-scrollbar-rail {
    background: #FFFFFF;
}
/* remove font icon */
.z-scrollbar-horizontal .z-scrollbar-icon {
    display: none;
}

You can check the customized result.

Use Browser Default scrollbar

To disable custom scrollbar provided by ZK 7. Add the library property called org.zkoss.zul.nativebar in zk.xml and set it to true.

<library-property>
    <name>org.zkoss.zul.nativebar</name>
    <value>true</value>
</library-property>

Note: the value of org.zkoss.zul.nativebar is true by default (since 7.0.2)

Tip 2 Appendix

Component ZK 6.5 mold ZK 7 mold
Button os
trendy
default

Textbox
Intbox
Decimalbox
Longbox
Doublebox
Combobox
Bandbox
Datebox
Timebox
Spinner
Doublespinner

default
rounded
default
Splitter default
os
default
Tabbox accordion
accordion-lite
accordion

Tip 2 Appendix

Component ZK 6.5 mold ZK 7 mold
Button os
trendy
default

Textbox
Intbox
Decimalbox
Longbox
Doublebox
Combobox
Bandbox
Datebox
Timebox
Spinner
Doublespinner

default
rounded
default
Splitter default
os
default
Tabbox accordion
accordion-lite
accordion

Tip 3 Appendix

Component ZK 6.5 sample ZK 7 sample
Splitter

z-splitter-hor
z-splitter-ver

z-splitter z-splitter-horizontal
z-splitter z-splitter-vertical

Slider

z-slider-hor
z-slider-ver

z-slider z-slider-horizontal
z-slider z-slider-vertical

Menubar

z-menubar-hor
z-menubar-ver

z-menubar z-menubar-horizontal
z-menubar z-menubar-vertical

Toolbar z-toolbar-tabs z-toolbar z-toolbar-tabs
Combobutton z-combobutton-toolbar z-combobutton z-combobutton-toolbar
Separator

z-separator-horizontal
z-separator-vertical

z-separator z-separator-horizontal
z-separator z-separator-vertical

Groupbox

z-groupbox-3d

z-groupbox z-groupbox-3d

Tabbox

z-tabbox

z-tabbox-ver

z-tabbox-accordion

z-tabbox z-tabbox-top
z-tabbox z-tabbox-bottom
z-tabbox z-tabbox-left
z-tabbox z-tabbox-right
z-tabbox z-tabbox-accordion

Window

z-window-embedded
z-window-modal
z-window-highlighted
z-window-overlapped
z-window-popup

z-window z-window-embedded
z-window z-window-modal
z-window z-window-highlighted
z-window z-window-overlapped
z-window z-window-popup

Tip 2 Appendix

Component ZK 6.5 mold ZK 7 mold
Button os
trendy
default

Textbox
Intbox
Decimalbox
Longbox
Doublebox
Combobox
Bandbox
Datebox
Timebox
Spinner
Doublespinner

default
rounded
default
Splitter default
os
default
Tabbox accordion
accordion-lite
accordion

Tip 3 Appendix

Component ZK 6.5 sample ZK 7 sample
Splitter

z-splitter-hor
z-splitter-ver

z-splitter z-splitter-horizontal
z-splitter z-splitter-vertical

Slider

z-slider-hor
z-slider-ver

z-slider z-slider-horizontal
z-slider z-slider-vertical

Menubar

z-menubar-hor
z-menubar-ver

z-menubar z-menubar-horizontal
z-menubar z-menubar-vertical

Toolbar z-toolbar-tabs z-toolbar z-toolbar-tabs
Combobutton z-combobutton-toolbar z-combobutton z-combobutton-toolbar
Separator

z-separator-horizontal
z-separator-vertical

z-separator z-separator-horizontal
z-separator z-separator-vertical

Groupbox

z-groupbox-3d

z-groupbox z-groupbox-3d

Tabbox

z-tabbox

z-tabbox-ver

z-tabbox-accordion

z-tabbox z-tabbox-top
z-tabbox z-tabbox-bottom
z-tabbox z-tabbox-left
z-tabbox z-tabbox-right
z-tabbox z-tabbox-accordion

Window

z-window-embedded
z-window-modal
z-window-highlighted
z-window-overlapped
z-window-popup

z-window z-window-embedded
z-window z-window-modal
z-window z-window-highlighted
z-window z-window-overlapped
z-window z-window-popup

Tip 4 Appendix

Component ZK 6.5 DOM structure ZK 7 DOM structure

Button

Trendy mold
<span class="z-button">
    <table>
        <tr>
            <td class="z-button-tl">
                <button class="z-button" />
            <td class="z-button-tm"></td>
            <td class="z-button-tr"></td>
        </tr>
        <tr>
            <td class="z-button-cl"></td>
            <td class="z-button-cm"></td>
            <td class="z-button-cr"></td>
        </tr>
        <tr>
            <td class="z-button-bl"></td>
            <td class="z-button-bm"></td>
            <td class="z-button-br"></td>
        </tr>
    </table>
</span>
<button class="z-button" />

Caption

<table class="z-caption">
    <tr>
        <td class="z-caption-l"></td>
        <td class="z-caption-r"></td>
    </tr>
</table>
<div class="z-caption">
    <div class="z-caption-content"></div>
</div>

Combobutton

<span class="z-combobutton">
    <table>
        <tr>
            <td class="z-combobutton-tl">
                <button class="z-combobutton" />
            <td class="z-combobutton-tm"></td>
            <td class="z-combobutton-tr"></td>
        </tr>
        <tr>
            <td class="z-combobutton-cl"></td>
            <td class="z-combobutton-cm"></td>
            <td class="z-combobutton-cr">
              <div>
                <div class="z-combobutton-btn-img" />
              </div>
            </td>
        </tr>
        <tr>
            <td class="z-combobutton-bl"></td>
            <td class="z-combobutton-bm"></td>
            <td class="z-combobutton-br"></td>
        </tr>
    </table>
</span>
<span class="z-combobutton">
    <span class="z-combobutton-content">
        <span class="z-combobutton-text" />
        <span class="z-combobutton-button">
            <i class="z-combobutton-icon" />
        </span>
    </span>
</span>

Textbox
Intbox
Decimalbox
Longbox
Doublebox

rounded mold
<i class="z-component-rounded">
    <input class="z-component-rounded-inp" />
    <i class="z-component-rounded-right-edge" />
</i>
<input class="z-component" />

Groupbox

<div class="z-groupbox">
    <div class="z-groupbox-tl">
        <div class="z-groupbox-tr"></div>
    </div>
    <div class="z-groupbox-hl">
        <div class="z-groupbox-hr">
            <div class="z-groupbox-hm">
                <div class="z-groupbox-header"></div>
            </div>
        </div>
    </div>
    <div class="z-groupbox-cnt"></div>
</div>
<div class="z-groupbox">
    <div class="z-groupbox-header"></div>
    <div class="z-groupbox-content"></div>
</div>

Panel

<div class="z-panel">
    <div class="z-panel-tl">
        <div class="z-panel-tr"></div>
    </div>
    <div class="z-panel-hl">
        <div class="z-panel-hr">
            <div class="z-panel-hm">
                <div class="z-panel-header"></div>
            </div>
        </div>
    </div>
    <div class="z-panel-body">
        <div class="z-panel-cl">
            <div class="z-panel-cr">
                <div class="z-panel-cm">
                    <div class="z-panelchildren"></div>
                </div>
            </div>
        </div>
        <div class="z-panel-fl">
            <div class="z-panel-fr">
                <div class="z-panel-fm"></div>
            </div>
        </div>
        <div class="z-panel-bl">
            <div class="z-panel-br"></div>
        </div>
    </div>
</div>
<div class="z-panel">
    <div class="z-panel-head">
        <div class="z-panel-header"></div>
    </div>
    <div class="z-panel-body">
        <div class="z-panelchildren"></div>
    </div>
</div>

Window

<div class="z-window">
    <div class="z-window-tl">
        <div class="z-window-tr"></div>
    </div>
    <div class="z-window-hl">
        <div class="z-window-hr">
            <div class="z-window-hm">
                <div class="z-window-header"></div>
            </div>
        </div>
    </div>
    <div class="z-window-cl">
        <div class="z-window-cr">
            <div class="z-window-cm">
                <div class="z-window-cnt"></div>
            </div>
        </div>
    </div>
    <div class="z-window-bl">
        <div class="z-window-br"></div>
    </div>
</div>
<div class="z-window">
    <div class="z-window-header"></div>
    <div class="z-window-content"></div>
</div>

Tab

horizontal / vertical orient
<li class="z-tab">
    <a class="z-tab-close"></a>
    <div class="z-tab-hl">
        <div class="z-tab-hr">
            <div class="z-tab-hm"></div>
        </div>
    </div>
</li>
<li class="z-tab">
    <a class="z-tab-content">
        <div class="z-tab-button"></div>
        <span class="z-tab-text"></span>
    </a>
</li>

Tip 5 Appendix

Category ZK 6.5 class name ZK 7 class name
Layout Elements -outer -outer
-body -body
-header -header
-inner -inner
-cnt -content
-footer -footer
-noheader -noheader
-noborder -noborder
-nofooter deprecated*
Other Elements -faker -faker
-text -text
-inp -input
-sep -separator
-img -image (for comoponent's API, such as Button.setImage())
-icon (for comopnent's interaction, such as drop-down button on combobox)
-pp -popup
-btn -button
Switch Icons -close -close
-colps -collapse
-colpsd -collapsed
-exp -expand
-expd -expanded
Resize Icons -max -maximize
-maxd -maximized
-min -minimize
-mind deprecated*
Split Icons -splt -splitter
-ns -nosplitter
Orient and Position -ver -vertical
-hor -horizontal
-start -start
-center -center
-end -end
Event Effect -clk :active or -click
-focus :focus or -focus
-over :hover or -hover
-drag -drag
-drop deprecated*
-seld -selected
-ck -checked
-unck -unchecked
-disd [disabled] or -disabled
-visi :visited or -visited
-hide deprecated*
-invalid -invalid
-readonly [readonly] or -readonly
  • deprecated means it is never used in 7.0



Last Update : 2023/09/22

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.