Class WFavicon
- Direct Known Subclasses:
WFaviconPair,WRasterFavicon,WResourceFavicon,WUrlFavicon
The favicon of a page is an icon that is used by the browser to represent the page in its user interface. In modern browsers, this is usualy showed on the browser tab of the page.
Changing the favicon of a page can be used to notify the user that something happend on the page without the having to use notifications, which can feel invasive and requires the user's approval to be used. This class is designed with this idea in mind.
A WFavicon can be in 2 states:
- Updated: used to notify the user
- Default: used otherwise
The state of the WFavicon can be changed using update() and
reset().
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoReset()Resets the favicon.protected voiddoUpdate()Updates the favicon.abstract StringgetUrl()Returns the url to the favicon.booleanReturns whether the favicon is in its update state or not.voidreset()Sets the favicon in its default state.voidupdate()Sets the favicon in its update state.
-
Constructor Details
-
WFavicon
protected WFavicon()
-
-
Method Details
-
getUrl
Returns the url to the favicon.This should return the absolute url to the favicon.
-
update
public void update()Sets the favicon in its update state.This sets the favicon in its update state.
If you want the favicon to be different in its updated state, you should override
doUpdate(), which is called at the end of this function.Note: Despite its name, this does not push any updates to the browser unless it changes the url of the favicon.
- See Also:
-
reset
public void reset()Sets the favicon in its default state.Sets the favicon in its default state.
If you did any changes in
doUpdate(), you should clean up those changes indoReset(), which is called at the end of this function.Note: This does not push any updates to the browser unless it changes the url of the favicon.
- See Also:
-
isUpdated
public boolean isUpdated()Returns whether the favicon is in its update state or not.- See Also:
-
doUpdate
protected void doUpdate()Updates the favicon.This is called at the end of
update()and does nothing by default. You can override this function to make changes to the favicon whenupdate()is called.If you do so, you will likely want to clean up those changes in
doReset().Note: If you want those changes to be pushed to the client, you have to make sure that this updates the url of the favicon.
- See Also:
-
doReset
protected void doReset()Resets the favicon.This is called at the end of
reset()and should be overriden to make it clean up what was done indoUpdate().Note: If you want those changes to be pushed to the client, you have to make sure that this updates the url of the favicon.
- See Also:
-