TV-Browser 2.7.5 API

util.ui
Class ProgramPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by util.ui.ProgramPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, ChangeListener, PluginStateListener

public class ProgramPanel
extends JComponent
implements ChangeListener, PluginStateListener

A ProgramPanel is a JComponent representing a single program.

Author:
Martin Oberhauser, Til Schneider, www.murfman.de
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int X_AXIS
          Deprecated. since 2.7 Use ProgramPanelSettings.X_AXIS instead
static int Y_AXIS
          Deprecated. since 2.7 Use ProgramPanelSettings.Y_AXIS instead
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS
 
Constructor Summary
ProgramPanel()
          Creates a new instance of ProgramPanel.
ProgramPanel(boolean showOnlyDateAndTitle)
          Deprecated. Since 2.2.2 Use ProgramPanel(ProgramPanelSettings) instead.
ProgramPanel(Program prog)
          Creates a new instance of ProgramPanel.
ProgramPanel(Program prog, boolean showOnlyDateAndTitle)
          Deprecated. Since 2.2.2 Use ProgramPanel(Program, ProgramPanelSettings) instead.
ProgramPanel(Program prog, int axis)
          Deprecated. Since 2.7 Use ProgramPanel(Program, ProgramPanelSettings) instead.
ProgramPanel(Program prog, int axis, boolean showOnlyDateAndTitle)
          Deprecated. Since 2.2.2 Use ProgramPanel(Program, int, ProgramPanelSettings) instead.
ProgramPanel(Program prog, int axis, ProgramPanelSettings settings)
          Creates a new instance of ProgramPanel.
ProgramPanel(ProgramPanelSettings settings)
          Creates a new instance of ProgramPanel.
ProgramPanel(ProgramPanelSettings settings, int axis)
          Deprecated. Since 2.7 Use ProgramPanel(ProgramPanelSettings) instead.
ProgramPanel(Program prog, ProgramPanelSettings settings)
          Creates a new instance of ProgramPanel.
 
Method Summary
 void addNotify()
          Called when the panel is added to a container.
 void addPluginContextMenuMouseListener(ContextMenuIf caller)
          Adds a MouseListener that shows the plugin context menu when the user does a right click on the program panel.
 void forceRepaint()
          Repaints the complete panel.
 int getHeight()
          Gets the height.
 int getMinimumHeight()
           
 int getPreferredHeight()
          Gets the preferred height.
 Program getProgram()
          Gets the program object of this ProgramPanel.
 Color getTextColor()
          Returns the Color of the Text
 void paint(boolean mouse, boolean isSelected, Graphics g)
          Paints the ProgramPanel
 void paintComponent(Graphics g)
          Paints the component.
 void pluginActivated(PluginProxy plugin)
           
 void pluginDeactivated(PluginProxy plugin)
           
 void pluginLoaded(PluginProxy plugin)
           
 void pluginUnloaded(PluginProxy plugin)
           
 void programHasChanged()
          Should be called, when the program has changed.
 void removeNotify()
          Called when the panel is added to a container.
 void setHeight(int height)
          Sets the height of this panel
 void setMaximumHeight()
           
 void setPaintExpiredProgramsPale(boolean value)
          Sets if expired programs should be painted pale.
 void setProgram(Program program)
          Sets the program this panel shows.
 void setProgram(Program program, int maxHeight)
          Sets the program this panel shows.
 void setProgramPanelSettings(ProgramPanelSettings settings)
          Change the settings of this panel.
 void setTextColor(Color col)
          Sets the Color of the Text
 void stateChanged(ChangeEvent evt)
          Called when the state of the program has changed.
static void updateColumnWidth()
          (Re)Loads the column width settings.
static int updateColumnWidth(int newOffset)
           
static void updateFonts()
          Reloads the font settings and sets the dynamic font size to standard font size again
static boolean updateFonts(int newOffset)
          Reloads the font settings and sets a dynamic font size
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

X_AXIS

public static final int X_AXIS
Deprecated. since 2.7 Use ProgramPanelSettings.X_AXIS instead
Orientation Progressbar in X_AXIS

See Also:
Constant Field Values

Y_AXIS

public static final int Y_AXIS
Deprecated. since 2.7 Use ProgramPanelSettings.Y_AXIS instead
Orientation Progressbar in Y_AXIS

See Also:
Constant Field Values
Constructor Detail

ProgramPanel

public ProgramPanel()
Creates a new instance of ProgramPanel.


ProgramPanel

public ProgramPanel(ProgramPanelSettings settings)
Creates a new instance of ProgramPanel.

Parameters:
settings - The settings for this program panel.
Since:
2.2.2

ProgramPanel

public ProgramPanel(Program prog)
Creates a new instance of ProgramPanel.

Parameters:
prog - The program to show in this panel.

ProgramPanel

public ProgramPanel(Program prog,
                    ProgramPanelSettings settings)
Creates a new instance of ProgramPanel.

Parameters:
prog - The program to show in this panel.
settings - The settings for this program panel.
Since:
2.2.2

ProgramPanel

public ProgramPanel(Program prog,
                    int axis,
                    ProgramPanelSettings settings)
Creates a new instance of ProgramPanel.

Parameters:
prog - The program to show in this panel.
axis - Orientation of ProgressBar (X_AXIS/Y_AXIS)
settings - The settings for this program panel.
Since:
2.2.2

ProgramPanel

public ProgramPanel(boolean showOnlyDateAndTitle)
Deprecated. Since 2.2.2 Use ProgramPanel(ProgramPanelSettings) instead.

Creates a new instance of ProgramPanel.

Parameters:
showOnlyDateAndTitle - If this panel should only show date time and title.
Since:
2.2.1

ProgramPanel

public ProgramPanel(Program prog,
                    int axis)
Deprecated. Since 2.7 Use ProgramPanel(Program, ProgramPanelSettings) instead.

Creates a new instance of ProgramPanel.

Parameters:
prog - The program to show in this panel.
axis - Orientation of ProgressBar (X_AXIS/Y_AXIS)

ProgramPanel

public ProgramPanel(Program prog,
                    boolean showOnlyDateAndTitle)
Deprecated. Since 2.2.2 Use ProgramPanel(Program, ProgramPanelSettings) instead.

Creates a new instance of ProgramPanel.

Parameters:
prog - The program to show in this panel.
showOnlyDateAndTitle - If this panel should only show date time and title.
Since:
2.2.1

ProgramPanel

public ProgramPanel(Program prog,
                    int axis,
                    boolean showOnlyDateAndTitle)
Deprecated. Since 2.2.2 Use ProgramPanel(Program, int, ProgramPanelSettings) instead.

Creates a new instance of ProgramPanel.

Parameters:
prog - The program to show in this panel.
axis - Orientation of ProgressBar (X_AXIS/Y_AXIS)
showOnlyDateAndTitle - If this panel should only show date time and title.
Since:
2.2.1

ProgramPanel

public ProgramPanel(ProgramPanelSettings settings,
                    int axis)
Deprecated. Since 2.7 Use ProgramPanel(ProgramPanelSettings) instead.

Creates a new instance of ProgramPanel.

Parameters:
settings - The settings for this program panel.
axis - The axis of the progress bar.
Method Detail

updateFonts

public static boolean updateFonts(int newOffset)
Reloads the font settings and sets a dynamic font size

Parameters:
newOffset - increase or decrease compared to standard font size
Since:
2.6

updateFonts

public static void updateFonts()
Reloads the font settings and sets the dynamic font size to standard font size again


setProgramPanelSettings

public void setProgramPanelSettings(ProgramPanelSettings settings)
Change the settings of this panel.

Parameters:
settings - The settings of this panel.

forceRepaint

public void forceRepaint()
Repaints the complete panel.


updateColumnWidth

public static void updateColumnWidth()
(Re)Loads the column width settings.


updateColumnWidth

public static int updateColumnWidth(int newOffset)

getPreferredHeight

public int getPreferredHeight()
Gets the preferred height.

It's the height the panel has with a maximum of 3 information rows.

Returns:
The preferred height.

setHeight

public void setHeight(int height)
Sets the height of this panel

Parameters:
height -

setMaximumHeight

public void setMaximumHeight()

getHeight

public int getHeight()
Gets the height.

Overrides:
getHeight in class JComponent
Returns:
The height.

setProgram

public void setProgram(Program program)
Sets the program this panel shows.

Parameters:
program - The program to show in this panel.

setProgram

public void setProgram(Program program,
                       int maxHeight)
Sets the program this panel shows.

Parameters:
program - The program to show in this panel.
maxHeight - The maximum height the program should have (in pixels).

paintComponent

public void paintComponent(Graphics g)
Paints the component.

Overrides:
paintComponent in class JComponent
Parameters:
g - The graphics context to paint to.

addNotify

public void addNotify()
Called when the panel is added to a container.

registers the panel as ChangeListener at the program.

Overrides:
addNotify in class JComponent

removeNotify

public void removeNotify()
Called when the panel is added to a container.

removes the panel as ChangeListener from the program.

Overrides:
removeNotify in class JComponent

getProgram

public Program getProgram()
Gets the program object of this ProgramPanel.

Returns:
the program object of this ProgramPanel.

addPluginContextMenuMouseListener

public void addPluginContextMenuMouseListener(ContextMenuIf caller)
Adds a MouseListener that shows the plugin context menu when the user does a right click on the program panel.

Parameters:
caller - The ContextMenuIf to exclude from the context menu. When null no ContextMenuIf is excluded.

programHasChanged

public void programHasChanged()
Should be called, when the program has changed.

If you use this program panel directly (this is the case, when you have added it into a JPanel), you don't have to call this method. This is done automatically.

But if you use this panel just as renderer (e.g. for a list) you have to register at the programs as ChangeListener and call this method when ChangeListener.stateChanged(javax.swing.event.ChangeEvent) was called.

See Also:
Program.addChangeListener(ChangeListener)

stateChanged

public void stateChanged(ChangeEvent evt)
Called when the state of the program has changed.

repaints the panel.

Specified by:
stateChanged in interface ChangeListener
Parameters:
evt - The event describing the change.

setTextColor

public void setTextColor(Color col)
Sets the Color of the Text

Parameters:
col - Color of the Text

getTextColor

public Color getTextColor()
Returns the Color of the Text

Returns:
Color of the Text

paint

public void paint(boolean mouse,
                  boolean isSelected,
                  Graphics g)
Paints the ProgramPanel

Parameters:
mouse - under a Mouse and needs highlight?
isSelected - IsSelected program?
g - Graphics-Object

getMinimumHeight

public int getMinimumHeight()
Returns:
The smallest height possible.

setPaintExpiredProgramsPale

public void setPaintExpiredProgramsPale(boolean value)
Sets if expired programs should be painted pale.

Parameters:
value - True if expired programs should be painted pale, false otherwise.
Since:
2.7

pluginActivated

public void pluginActivated(PluginProxy plugin)
Specified by:
pluginActivated in interface PluginStateListener

pluginDeactivated

public void pluginDeactivated(PluginProxy plugin)
Specified by:
pluginDeactivated in interface PluginStateListener

pluginLoaded

public void pluginLoaded(PluginProxy plugin)
Specified by:
pluginLoaded in interface PluginStateListener

pluginUnloaded

public void pluginUnloaded(PluginProxy plugin)
Specified by:
pluginUnloaded in interface PluginStateListener

TV-Browser 2.7.5 API

TV-Browser 2.7.5, Copyright (C) 04-2003 Martin Oberhauser (martin@tvbrowser.org)