base
Class CustomPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JScrollPane
                  extended by base.CustomPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ScrollPaneConstants
Direct Known Subclasses:
DialoguePanel, KeyHelpPanel, RecordPanel, SearchPanel, StationsPanel

public class CustomPanel
extends JScrollPane

This is the base class for all panels that are displayed from time to time to offer additional user interaction. These custom panels are added to the main window by calling PoddyFrame.setCustomPanel() and replace the standard media info listing. This class inherits from JScrollComponent to offer vertical scolling functionality for istings that are bigger than the available space on the screen.

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.Component
Component.BaselineResizeBehavior
 
Field Summary
 JFixedPanel mainPanel
           
static int MAX_IMAGES
           
 int prevSelected
           
 int selected
           
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CustomPanel()
          Default constructor for a CustomPanel.
 
Method Summary
 Component add(Component arg0)
          Overwrites the add()-method in order to add new elements to the top level scroll pane only; this is necessary because the contents of a CustomPanel dont have to be added to the panel (which is a scroll pane) directly but to its child panel (which is a real JPanel)
 void add(Component arg0, Object arg1)
          Overwrites the add()-method in order to add new elements to the top level scroll pane only; this is necessary because the contents of a CustomPanel dont have to be added to the panel (which is a scroll pane) directly but to its child panel (which is a real JPanel)
 boolean canBeAborted()
          This method specifies if the panel can be aborted: if it returns true the main application exits this panel in case the menu button was pressed on the remote control or in case the F12 key was used
 boolean closePanel()
          This method has to be implemented by classes that inherit from CustomPanel wherever it is necessary: when a CustomPanel is removed by the main application first closePanel() is called, then the panel is removed from the main window so that the standard view is visible again and afterwards postClosePanel() is executed.
 int getResultID()
          This method belons to the post/ClosePanel() methods: after the operation of a CustomPanel is finished and after this paneol was removed from the main view using this method a code is returned to the main application in order to inform about the operation and its result
 void otherKeyEvent(int keyCode, char keyChar)
          This method is called either by other commands of the remote control or by pressing other keyboard keys.
 void paintComponent(Graphics g)
          This method overwrites the related paintComponent() method from the base class, here the background of the panel is painted (together with a background image that may be configured for the application.
 void postClosePanel()
          This method has to be implemented by classes that inherit from CustomPanel wherever it is necessary: when a CustomPanel is removed by the main application first closePanel() is called, then the panel is removed from the main window so that the standard view is visible again and afterwards postClosePanel() is executed.
 void remove(Component arg0)
          Overwrites the remove()-method in order to remove all elements from the top level scroll pane only; this is necessary because the contents of a CustomPanel dont have to be added to the panel (which is a scroll pane) directly but to its child panel (which is a real JPanel)
 void removeAll()
           
 void scrollComponentToVisible(JComponent component)
          Whenever a item within the list of elements (e.g.
 void scrollComponentToVisible(JComponent component, boolean asyncScroll)
          Whenever a item within the list of elements (e.g.
 void sendNum(int num)
          This method is called either numbers pressed on the remote control or on a connected keyboard
This method has to be implemented by classes that inherit from CustomPanel
 boolean setSelectedField(int idx)
          Deprecated. use switchHorizontal() instead
 boolean switchHorizontal(int dir)
          This method is called either by the up/down commands of the remote control or by pressing the cursor keys for up/down and modifies the selection of the elements within the panel
This method has to be implemented by classes that inherit from CustomPanel
 boolean switchVertical(int dir)
          This method is called either by the left/right commands of the remote control or by pressing the cursor keys for left/right.
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, addContainerListener, 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, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_IMAGES

public static final int MAX_IMAGES
See Also:
Constant Field Values

mainPanel

public JFixedPanel mainPanel

selected

public int selected

prevSelected

public int prevSelected
Constructor Detail

CustomPanel

public CustomPanel()
Default constructor for a CustomPanel. It sets up a panel and adds a scroll pane to it so that the contents within the panel can be bigger than the available display. All subsequent calls to add() are catched within this class to act on the scroll pane and not on the CustomPanel itself. Because of that structure you mustn't set a layout manager for the scroll pane, it automatically uses GridBagLayout.

Method Detail

scrollComponentToVisible

public void scrollComponentToVisible(JComponent component,
                                     boolean asyncScroll)
Whenever a item within the list of elements (e.g. Artists or DVD titles) is selected it should be visible to the user. That is important especially when a list is bigger than the visible area of the main window. This method can be called to scroll within the current CustomPanel so that the selected component becomes visible.

Parameters:
component - the component that has to be scrolled to the visible area
asyncScroll - when this value is set to true scrolling is not done immediately but later when there is time for it

paintComponent

public void paintComponent(Graphics g)
This method overwrites the related paintComponent() method from the base class, here the background of the panel is painted (together with a background image that may be configured for the application.
This method never has to be called directly but only via repaint-actions!

Overrides:
paintComponent in class JComponent

scrollComponentToVisible

public void scrollComponentToVisible(JComponent component)
Whenever a item within the list of elements (e.g. Artists or DVD titles) is selected it should be visible to the user. That is important especially when a list is bigger than the visible area of the main window. This method can be called to scroll within the current CustomPanel immediately so that the selected component becomes visible. Here a syncronous scrolling operation is executes so that a call to this method is the same like calling scrollComponentToVisible(component,false);

Parameters:
component - the component that has to be scrolled to the visible area

add

public void add(Component arg0,
                Object arg1)
Overwrites the add()-method in order to add new elements to the top level scroll pane only; this is necessary because the contents of a CustomPanel dont have to be added to the panel (which is a scroll pane) directly but to its child panel (which is a real JPanel)

Overrides:
add in class Container
Parameters:
arg0 - component to add
arg1 - layout information for that component

add

public Component add(Component arg0)
Overwrites the add()-method in order to add new elements to the top level scroll pane only; this is necessary because the contents of a CustomPanel dont have to be added to the panel (which is a scroll pane) directly but to its child panel (which is a real JPanel)

Overrides:
add in class Container
Parameters:
arg0 - component to add

remove

public void remove(Component arg0)
Overwrites the remove()-method in order to remove all elements from the top level scroll pane only; this is necessary because the contents of a CustomPanel dont have to be added to the panel (which is a scroll pane) directly but to its child panel (which is a real JPanel)

Overrides:
remove in class Container
Parameters:
arg0 - component to add

removeAll

public void removeAll()
Overrides:
removeAll in class Container

switchHorizontal

public boolean switchHorizontal(int dir)
This method is called either by the up/down commands of the remote control or by pressing the cursor keys for up/down and modifies the selection of the elements within the panel
This method has to be implemented by classes that inherit from CustomPanel

Parameters:
dir - specifies the direction the selection has to be changed into, here values 1 and -1 are allowed

switchVertical

public boolean switchVertical(int dir)
This method is called either by the left/right commands of the remote control or by pressing the cursor keys for left/right. For these elements that support it this additional selection can be used to alternate the contents or to display alternate values
This method has to be implemented by classes that inherit from CustomPanel

Parameters:
dir - specifies the direction the selection has to be changed into, here values 1 and -1 are allowed

otherKeyEvent

public void otherKeyEvent(int keyCode,
                          char keyChar)
This method is called either by other commands of the remote control or by pressing other keyboard keys.
This method has to be implemented by classes that inherit from CustomPanel

Parameters:
dir - specifies the direction the selection has to be changed into, here values 1 and -1 are allowed

sendNum

public void sendNum(int num)
This method is called either numbers pressed on the remote control or on a connected keyboard
This method has to be implemented by classes that inherit from CustomPanel

Parameters:
dir - specifies the direction the selection has to be changed into, here values 1 and -1 are allowed

setSelectedField

public boolean setSelectedField(int idx)
Deprecated. use switchHorizontal() instead

Parameters:
idx -
Returns:

closePanel

public boolean closePanel()
This method has to be implemented by classes that inherit from CustomPanel wherever it is necessary: when a CustomPanel is removed by the main application first closePanel() is called, then the panel is removed from the main window so that the standard view is visible again and afterwards postClosePanel() is executed. Depending on what the CustomPanel has displayed and depending on what is was used for possibly necessary deinitializations have to be done here within closePanel() or within postClosePanel()


postClosePanel

public void postClosePanel()
This method has to be implemented by classes that inherit from CustomPanel wherever it is necessary: when a CustomPanel is removed by the main application first closePanel() is called, then the panel is removed from the main window so that the standard view is visible again and afterwards postClosePanel() is executed. Depending on what the CustomPanel has displayed and depending on what is was used for possibly necessary deinitializations have to be done here within postClosePanel() or within the preceding closePanel()


getResultID

public int getResultID()
This method belons to the post/ClosePanel() methods: after the operation of a CustomPanel is finished and after this paneol was removed from the main view using this method a code is returned to the main application in order to inform about the operation and its result

Returns:
the result ID; here no predefinitions are made, the value and its meaning depend on the panel that inherits from CustomPanel

canBeAborted

public boolean canBeAborted()
This method specifies if the panel can be aborted: if it returns true the main application exits this panel in case the menu button was pressed on the remote control or in case the F12 key was used