Class WFavicon

java.lang.Object
eu.webtoolkit.jwt.WFavicon
Direct Known Subclasses:
WFaviconPair, WRasterFavicon, WResourceFavicon, WUrlFavicon

public abstract class WFavicon extends Object
An abstract class representing a favicon.

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:

  1. Updated: used to notify the user
  2. Default: used otherwise

The state of the WFavicon can be changed using update() and reset().

See Also:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Resets the favicon.
    protected void
    Updates the favicon.
    abstract String
    Returns the url to the favicon.
    boolean
    Returns whether the favicon is in its update state or not.
    void
    Sets the favicon in its default state.
    void
    Sets the favicon in its update state.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WFavicon

      protected WFavicon()
  • Method Details

    • getUrl

      public abstract String 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 in doReset(), 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 when update() 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 in doUpdate().

      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: