Class IconDeckRadianceIcon<T>

  • Type Parameters:
    T - enumeration key into the deck
    All Implemented Interfaces:
    javax.swing.Icon, AsynchronousLoading, RadianceIcon

    public class IconDeckRadianceIcon<T>
    extends java.lang.Object
    implements RadianceIcon, AsynchronousLoading
    Implementation of the RadianceIcon that allows switching the icon painting at runtime. This class can be used as a delegate in the DecoratedRadianceIcon where the "base" icon is changed at runtime without the need to recompute all the decorators.
    • Field Detail

      • currentIcon

        private RadianceIcon currentIcon
        Currently shown icon.
      • iconDeck

        private final java.util.Map<T,​? extends RadianceIcon> iconDeck
        The icon deck.
    • Constructor Detail

      • IconDeckRadianceIcon

        public IconDeckRadianceIcon​(java.util.Map<T,​? extends RadianceIcon> iconDeck)
        Creates the icon deck.
        Parameters:
        iconDeck - Icon deck.
    • Method Detail

      • setIcon

        public void setIcon​(T key)
        Sets the currently shown icon.
        Parameters:
        key - Icon key.
      • setDimension

        public void setDimension​(java.awt.Dimension dim)
        Description copied from interface: RadianceIcon
        Changes the dimension of this icon.
        Specified by:
        setDimension in interface RadianceIcon
        Parameters:
        dim - New dimension for this icon.
      • getIconHeight

        public int getIconHeight()
        Specified by:
        getIconHeight in interface javax.swing.Icon
      • getIconWidth

        public int getIconWidth()
        Specified by:
        getIconWidth in interface javax.swing.Icon
      • paintIcon

        public void paintIcon​(java.awt.Component c,
                              java.awt.Graphics g,
                              int x,
                              int y)
        Specified by:
        paintIcon in interface javax.swing.Icon
      • isLoading

        public boolean isLoading()
        Description copied from interface: AsynchronousLoading
        Returns indication whether the content is still loading.
        Specified by:
        isLoading in interface AsynchronousLoading
        Returns:
        true if the content is still loading, false otherwise.