Directory

← Back

FaviconProgressindicator

Displays the progress as a favicon

Author

Contributors

Rating

This component comes in handy if you for example have several tabs open in your browser and waiting for a task to complete. The favicon in the browser tab will show a pie chart representing how far your task has progressed.

FaviconProgressindicator extends Vaadin's ProgressIndicator and should work with any version of Vaadin7 (that is not beta).

Check out the demo to see the component in action

Sample code

		final FaviconProgressIndicator pi = new FaviconProgressIndicator();
		pi.setPollingInterval(1000);
		pi.setValue(0f);

		layout.addComponent(pi);

// Here we create a background thread that tells how much progress is left:

		Runnable r = new Runnable() {
			
			@Override
			public void run() {
				for (int i = 0; i < 1000; i++) {
					
					try {
						getUI().getSession().getLockInstance().lock();
						// HERE updating the value
						pi.setValue(((float) (i + 1)) / 1000f);
						pi.markAsDirty();
					} finally {
						getUI().getSession().getLockInstance().unlock();
					}
					
					try {
						Thread.sleep(150);
					} catch (InterruptedException e) {

					}
				}
				
			}
		};
		new Thread(r).start();

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Released
2013-05-16
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.0+
Browser
Firefox
Opera
Google Chrome
Online