TV-Browser 3.3.3 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:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.swing.event.ChangeListener, PluginStateListener

public class ProgramPanel
extends javax.swing.JComponent
implements javax.swing.event.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
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int WIDTH_LEFT
          The width of the left part (the time).
 
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, WIDTH
 
Constructor Summary
ProgramPanel()
          Creates a new instance of ProgramPanel.
ProgramPanel(Program prog)
          Creates a new instance of ProgramPanel.
ProgramPanel(Program prog, int axis, ProgramPanelSettings settings)
          Creates a new instance of ProgramPanel.
ProgramPanel(ProgramPanelSettings settings)
          Creates a new instance of ProgramPanel.
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.
 java.awt.Color getTextColor()
          Returns the Color of the Text
 int getTitleX()
          get the X offset of the title in pixels
 java.lang.String getToolTipText(int x, int y)
          get the tooltip text for the local mouse coordinates x and y
 java.lang.String getToolTipText(java.awt.event.MouseEvent event)
           
 void paint(boolean mouse, boolean isSelected, java.awt.Graphics g)
          Paints the ProgramPanel
 void paintComponent(java.awt.Graphics g)
          Paints the component.
 boolean pictureStateChanged()
           
 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 setMarkTime(int time)
           
 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 setSize(java.awt.Dimension d)
           
 void setSize(int width, int height)
           
 void setTextColor(java.awt.Color col)
          Sets the Color of the Text
 void setWidth(int newWidth)
           
 void stateChanged(javax.swing.event.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, 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, transferFocusBackward, 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, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WIDTH_LEFT

public static int WIDTH_LEFT
The width of the left part (the time).

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
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 javax.swing.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.

pictureStateChanged

public boolean pictureStateChanged()
Returns:
If the picture state is changed.

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(java.awt.Graphics g)
Paints the component.

Overrides:
paintComponent in class javax.swing.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 javax.swing.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 javax.swing.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. If 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(javax.swing.event.ChangeEvent evt)
Called when the state of the program has changed.

repaints the panel.

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

setTextColor

public void setTextColor(java.awt.Color col)
Sets the Color of the Text

Parameters:
col - Color of the Text

getTextColor

public java.awt.Color getTextColor()
Returns the Color of the Text

Returns:
Color of the Text

paint

public void paint(boolean mouse,
                  boolean isSelected,
                  java.awt.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

getToolTipText

public java.lang.String getToolTipText(int x,
                                       int y)
get the tooltip text for the local mouse coordinates x and y

Parameters:
x -
y -
Returns:
tooltip text or null, if there is nothing "special" at the coordinates

getTitleX

public int getTitleX()
get the X offset of the title in pixels

Returns:
X offset of the title in pixels

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
Overrides:
getToolTipText in class javax.swing.JComponent

setSize

public void setSize(java.awt.Dimension d)
Overrides:
setSize in class java.awt.Component

setSize

public void setSize(int width,
                    int height)
Overrides:
setSize in class java.awt.Component

setWidth

public void setWidth(int newWidth)

setMarkTime

public void setMarkTime(int time)

TV-Browser 3.3.3 API

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