Module tvbrowser

Class Persona


  • public final class Persona
    extends java.lang.Object
    A class to handle Personas for TV-Browser.

    Since:
    3.1
    Author:
    René Mach
    • Field Detail

      • NAME_KEY

        public static final java.lang.String NAME_KEY
        The name key for the Persona properties
        See Also:
        Constant Field Values
      • DESCRIPTION_KEY

        public static final java.lang.String DESCRIPTION_KEY
        The description key for the Persona properties
        See Also:
        Constant Field Values
      • HEADER_IMAGE_KEY

        public static final java.lang.String HEADER_IMAGE_KEY
        The header image key for the Persona properties
        See Also:
        Constant Field Values
      • FOOTER_IMAGE_KEY

        public static final java.lang.String FOOTER_IMAGE_KEY
        The footer image key for the Persona properties
        See Also:
        Constant Field Values
      • TEXT_COLOR_KEY

        public static final java.lang.String TEXT_COLOR_KEY
        The text color key for the Persona properties
        See Also:
        Constant Field Values
      • SHADOW_COLOR_KEY

        public static final java.lang.String SHADOW_COLOR_KEY
        The shadow color key for the Persona properties
        See Also:
        Constant Field Values
      • ACCENT_COLOR_KEY

        public static final java.lang.String ACCENT_COLOR_KEY
        The accent color key for the Persona properties
        See Also:
        Constant Field Values
      • DETAIL_URL_KEY

        public static final java.lang.String DETAIL_URL_KEY
        The detail url key for the Persona properties
        See Also:
        Constant Field Values
      • USER_PERSONA

        public static final java.lang.String USER_PERSONA
        The key for the space holder for images in the user Persona directory
        See Also:
        Constant Field Values
      • TVB_PERSONA

        public static final java.lang.String TVB_PERSONA
        The key for the space holder for images in the global TV-Browser Persona directory
        See Also:
        Constant Field Values
    • Method Detail

      • registerPersonaListener

        public void registerPersonaListener​(PersonaListener listener)
        Register the PersonaListener to listen to Persona changes.

        Parameters:
        listener - The listener to register.
      • removePersonaListerner

        @Deprecated(since="3.3.4")
        public void removePersonaListerner​(PersonaListener listener)
        Deprecated.
        since 3.3.4 because of typo use removePersonaListener(PersonaListener) instead.
        Remove the given listener.

        Parameters:
        listener - The listener to remove.
      • removePersonaListener

        public void removePersonaListener​(PersonaListener listener)
        Remove the given listener.

        Parameters:
        listener - The listener to remove.
      • applyPersona

        public void applyPersona()
        Applies the current selected Persona.
      • loadPersonas

        public void loadPersonas()
        Loads all available Personas.
      • getInstance

        public static Persona getInstance()
        Get the instance of this class.

        Returns:
        The instance of this class.
      • getHeaderImage

        public java.awt.image.BufferedImage getHeaderImage()
        Get the image for the header.

        Returns:
        The image for the header or null if there is none.
      • getFooterImage

        public java.awt.image.BufferedImage getFooterImage()
        Get the image for the footer.

        Returns:
        The image for the footer or null if there is none.
      • getTextColor

        public java.awt.Color getTextColor()
        Gets the color for the text foreground.

        Returns:
        The color for the text foreground.
      • getShadowColor

        public java.awt.Color getShadowColor()
        Gets the color for the text shadow. If equal to text color no shadow is painted.

        Returns:
        The color for the text shadow.
      • getAccentColor

        public java.awt.Color getAccentColor()
        Gets the accent color.

        Returns:
        The color for the text shadow.
      • getName

        public java.lang.String getName()
        Get the name of the current Persona.

        Returns:
        The name of the current Persona.
      • getDescription

        public java.lang.String getDescription()
        Get the description of the current Persona.

        Returns:
        The description of the current Persona.
      • getDetailURL

        public java.lang.String getDetailURL()
        Get the detail url of the current Persona.

        Returns:
        The detail url of the current Persona.
      • createPersonaMenu

        public javax.swing.JMenu createPersonaMenu()
        Create a menu that uses the Persona for painting.

        Returns:
        A menu that uses the Persona for painting.
      • getInstalledPersonas

        public PersonaInfo[] getInstalledPersonas()
        Get all installed Personas.

        Returns:
        All installed Personas.
      • updatePersona

        public void updatePersona​(java.lang.String id)
        Update the persona
        Parameters:
        id - The id.
      • getId

        public java.lang.String getId()
        Gets the id of the currently viewed persona

        Returns:
        The id of the currently viewed persona.
      • getUserPersonaDir

        public static java.io.File getUserPersonaDir()
        Returns:
        The directory for the user personas.
      • getPersonaInfo

        public PersonaInfo getPersonaInfo​(java.lang.String id)
        Parameters:
        id - The id of the Persona to get.
        Returns:
        The PersonaInfo for the given id.
      • activatePersona

        public void activatePersona​(PersonaInfo info)
        Activates the given Persona.

        Parameters:
        info - The Persona to activate.
      • removePersona

        public boolean removePersona​(PersonaInfo info)
        Removes the given Persona form the list.

        Parameters:
        info - The Persona to remove.
        Returns:
        true if the Persona could be removed.
      • paintButton

        public static void paintButton​(java.awt.Graphics g,
                                       javax.swing.JButton b)
        Paints the given button on the given Graphics with persona settings.

        Parameters:
        g - The graphics to paint on.
        b - The button to paint.
      • testPersonaForegroundAgainst

        public static java.awt.Color testPersonaForegroundAgainst​(java.awt.Color c)
        Test the given color against the Persona foreground color and returns a color that is readable on the given color.

        Parameters:
        c - The color to test.
        Returns:
        The readable Color.
      • createPersonaBackgroundPanel

        public static javax.swing.JPanel createPersonaBackgroundPanel()
        Returns:
        A JPanel with the Persona as Background.
      • createPersonaButton

        public static javax.swing.JButton createPersonaButton​(java.lang.String text)
        Creates a button that uses the Pesona colors.

        Parameters:
        text - Text of the button
        Returns:
        The created button.
      • createPersonaButton

        public static javax.swing.JButton createPersonaButton​(java.lang.String text,
                                                              javax.swing.Icon icon)
        Creates a button that uses the Pesona colors.

        Parameters:
        text - Text of the button
        icon - The icon for the button
        Returns:
        The created button.
      • getPersonaButtonBorder

        public static javax.swing.border.Border getPersonaButtonBorder()
        Gets the border for a Persona button

        Returns:
        The border for a Persona button.