- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- 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
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
textIconWidth
static int
WIDTH_LEFT
The width of the left part (the time).-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description 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(Program prog, ProgramPanelSettings settings)
Creates a new instance of ProgramPanel.ProgramPanel(ProgramPanelSettings settings)
Creates a new instance of ProgramPanel.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.ProgramPanelSettings
getSettings()
java.awt.Color
getTextColor()
Returns the Color of the Textint
getTitleX()
get the X offset of the title in pixelsjava.lang.String
getToolTipText(int x, int y)
get the tooltip text for the local mouse coordinates x and yjava.lang.String
getToolTipText(java.awt.event.MouseEvent event)
void
paint(boolean mouse, boolean isSelected, java.awt.Graphics g)
Paints the ProgramPanelvoid
paintComponent(java.awt.Graphics g)
Paints the component.static void
paintHighlighting(java.awt.Graphics2D grp, int x, int y, int width, int height, Marker[] markedByPluginArr, Program program, byte programImportance)
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 panelvoid
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
setSelected(boolean isSelected)
void
setSelectedInList(boolean isSelected)
void
setSize(int width, int height)
void
setSize(java.awt.Dimension d)
void
setTextColor(java.awt.Color col)
Sets the Color of the Textvoid
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 againstatic 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, 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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
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- Returns:
true
if fonts were update,false
if not.- 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
- The height to use.
-
setMaximumHeight
public void setMaximumHeight()
-
getHeight
public int getHeight()
Gets the height.- Overrides:
getHeight
in classjavax.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 classjavax.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 classjavax.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 classjavax.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. Ifnull
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.
-
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 interfacejavax.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 interfacePluginStateListener
-
pluginDeactivated
public void pluginDeactivated(PluginProxy plugin)
- Specified by:
pluginDeactivated
in interfacePluginStateListener
-
pluginLoaded
public void pluginLoaded(PluginProxy plugin)
- Specified by:
pluginLoaded
in interfacePluginStateListener
-
pluginUnloaded
public void pluginUnloaded(PluginProxy plugin)
- Specified by:
pluginUnloaded
in interfacePluginStateListener
-
getToolTipText
public java.lang.String getToolTipText(int x, int y)
get the tooltip text for the local mouse coordinates x and y- Parameters:
x
- The x position.y
- The y position.- 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 classjavax.swing.JComponent
-
setSize
public void setSize(java.awt.Dimension d)
- Overrides:
setSize
in classjava.awt.Component
-
setSize
public void setSize(int width, int height)
- Overrides:
setSize
in classjava.awt.Component
-
setWidth
public void setWidth(int newWidth)
-
setMarkTime
public void setMarkTime(int time)
-
getSettings
public ProgramPanelSettings getSettings()
-
setSelected
public void setSelected(boolean isSelected)
-
setSelectedInList
public void setSelectedInList(boolean isSelected)
-
-