We would like to introduce a new feature –
Loadingbar. It is a modern, lightweight loading animation for indicating the loading progress.
Here is a loading bar demo from start –> update –> finish.
// create a LoadingbarControl for control the loadingbar
LoadingbarControl loadingbarCtrl = Loadingbar.createLoadingbar("myId");
loadingbarCtrl.update(20); // update the value to 20
There is an option to display/hide the indeterminate animation.
loadingbarCtrl.update(true) // display the indeterminate animation.
- LoadingbarControl createLoadingbar():
Create a LoadingbarControl with a generated ID. The LoadingbarControl will find the Loadingbar by its id as the control target.
- LoadingbarControl createLoadingbar(String id):
Create a LoadingbarControl with a custom ID. The LoadingbarControl will find the Loadingbar by its id as the control target.
LoadingbarControl provides several methods to control a loading bar.
- String getId():Return the loading bar id.
- void start():Display a loading bar(value is 0) on the top of the browser window.
- void start(int value):Display a loading bar on the top of the browser window with an initial value.
- void start(int value, String position):Display a loading bar with an initial value and position.
- void start(int value, String position, boolean indeterminate):Display a loading bar with an initial value, position and whether you would like to display the indeterminate animation.
- void update(int value):Set the value to the loading bar.
- void update(boolean indeterminate):Set indeterminate to the loading bar.
- void finish():Finish the loading bar.
The loading bars are stackable, which means you can control multiple loading bars with different LoadingbarControl in a same browser tab.
For more information please refer to Loadingbar.
The whole demo project can be found on the GitHub project and we welcome you to try it out and share with us your feedback.
The feature will be available in upcoming ZK 9.0. You can already try it out using the 9.0 RC or freshly (nightly) builds. Feel free to download and tell us how you like it!