TV-Browser 3.3.3 API

util.ui.persona
Class Persona

java.lang.Object
  extended by util.ui.persona.Persona

public final class Persona
extends java.lang.Object

A class to handle Personas for TV-Browser.

Since:
3.1
Author:
René Mach

Field Summary
static java.lang.String ACCENT_COLOR_KEY
          The accent color key for the Persona properties
static java.lang.String DESCRIPTION_KEY
          The description key for the Persona properties
static java.lang.String DETAIL_URL_KEY
          The detail url key for the Persona properties
static java.lang.String FOOTER_IMAGE_KEY
          The footer image key for the Persona properties
static java.lang.String HEADER_IMAGE_KEY
          The header image key for the Persona properties
static java.lang.String NAME_KEY
          The name key for the Persona properties
static java.lang.String SHADOW_COLOR_KEY
          The shadow color key for the Persona properties
static java.lang.String TEXT_COLOR_KEY
          The text color key for the Persona properties
static java.lang.String TVB_PERSONA
          The key for the space holder for images in the global TV-Browser Persona directory
static java.lang.String USER_PERSONA
          The key for the space holder for images in the user Persona directory
 
Method Summary
 void activatePersona(PersonaInfo info)
          Activates the given Persona.
 void applyPersona()
          Applies the current selected Persona.
static javax.swing.JPanel createPersonaBackgroundPanel()
           
static javax.swing.JButton createPersonaButton(java.lang.String text)
          Creates a button that uses the Pesona colors.
static javax.swing.JButton createPersonaButton(java.lang.String text, javax.swing.Icon icon)
          Creates a button that uses the Pesona colors.
 javax.swing.JMenu createPersonaMenu()
          Create a menu that uses the Persona for painting.
 java.awt.Color getAccentColor()
          Gets the accent color.
 java.lang.String getDescription()
          Get the description of the current Persona.
 java.lang.String getDetailURL()
          Get the detail url of the current Persona.
 java.awt.image.BufferedImage getFooterImage()
          Get the image for the footer.
 java.awt.image.BufferedImage getHeaderImage()
          Get the image for the header.
 java.lang.String getId()
          Gets the id of the currently viewed persona
 PersonaInfo[] getInstalledPersonas()
          Get all installed Personas.
static Persona getInstance()
          Get the instance of this class.
 java.lang.String getName()
          Get the name of the current Persona.
static javax.swing.border.Border getPersonaButtonBorder()
          Gets the border for a Persona button
 PersonaInfo getPersonaInfo(java.lang.String id)
           
 java.awt.Color getShadowColor()
          Gets the color for the text shadow.
 java.awt.Color getTextColor()
          Gets the color for the text foreground.
static java.io.File getUserPersonaDir()
           
 void loadPersonas()
          Loads all available Personas.
static void paintButton(java.awt.Graphics g, javax.swing.JButton b)
          Paints the given button on the given Graphics with persona settings.
 void registerPersonaListener(PersonaListener listener)
          Register the PersonaListener to listen to Persona changes.
 boolean removePersona(PersonaInfo info)
          Removes the given Persona form the list.
 void removePersonaListerner(PersonaListener listener)
          Remove the given listener.
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.
 void updatePersona(java.lang.String id)
          Update the persona
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

public void removePersonaListerner(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 -

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.

TV-Browser 3.3.3 API

TV-Browser 3.3.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)