Skip to main content


com.sun.lwuit.list
Class DefaultListCellRenderer

java.lang.Object
  
extended by com.sun.lwuit.Component extended by com.sun.lwuit.Label extended by com.sun.lwuit.list.DefaultListCellRenderer
All Implemented Interfaces:
Animation, StyleListener, CellRenderer, ListCellRenderer

public class DefaultListCellRenderer
extends Label
implements ListCellRenderer, CellRenderer

Default implementation of the renderer based on a label see the ListCellRenderer for more information about the use and purpose of this class


Field Summary
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Constructor Summary
DefaultListCellRenderer()
          Creates a new instance of DefaultCellRenderer
DefaultListCellRenderer(boolean showNumbers)
          Creates a new instance of DefaultCellRenderer
 
Method Summary
 Component getCellRendererComponent(Component list, java.lang.Object model, java.lang.Object value, int index, boolean isSelected)
          Returns a component instance that is already set to render "value".
 Component getFocusComponent(Component list)
          Returns a component instance that is painted under the currently focused renderer and is animated to provide smooth scrolling.
 Component getListCellRendererComponent(List list, java.lang.Object value, int index, boolean isSelected)
          Returns a component instance that is already set to render "value".
 Component getListFocusComponent(List list)
          Returns a component instance that is painted under the currently focused renderer and is animated to provide smooth scrolling.
 int getSelectionTransparency()
          The background transparency factor to apply to the selection focus
 boolean isShowNumbers()
          Indicate whether numbering should exist for the default cell renderer
static boolean isShowNumbersDefault()
          Inidicates whether the default list cell renderer will show numbers by default when constructed
 void refreshTheme()
          Makes sure the component is up to date with the current style object
 void repaint()
          Overriden to do nothing and remove a performance issue where renderer changes perform needless repaint calls
 void setSelectionTransparency(int selectionTransparency)
          The background transparency factor to apply to the selection focus
 void setShowNumbers(boolean showNumbers)
          Indicate whether numbering should exist for the default cell renderer
static void setShowNumbersDefault(boolean def)
          Inidicates whether the default list cell renderer will show numbers by default when constructed
 
Methods inherited from class com.sun.lwuit.Label
animate, calcPreferredSize, getAlignment, getBaselineResizeBehavior, getGap, getIcon, getShiftText, getText, getTextPosition, getVerticalAlignment, isDefaultTickerEnabled, isEndsWith3Points, isTickerEnabled, isTickerRunning, paint, paramString, setAlignment, setDefaultTickerEnabled, setEndsWith3Points, setGap, setIcon, setShiftText, setText, setTextPosition, setTickerEnabled, setVerticalAlignment, shouldTickerStart, startTicker, startTicker, stopTicker
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, dragInitiated, drawDraggedImage, drop, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getDragImage, getGridPosX, getGridPosY, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getStyle, getTensileLength, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSelectableInteraction, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyPressed, keyReleased, keyRepeated, laidOut, longKeyPress, longPointerPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setCellRenderer, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultListCellRenderer

public DefaultListCellRenderer()
Creates a new instance of DefaultCellRenderer


DefaultListCellRenderer

public DefaultListCellRenderer(boolean showNumbers)
Creates a new instance of DefaultCellRenderer

Parameters:
showNumbers - indicates numbers should be shown
Method Detail

refreshTheme

public void refreshTheme()
Description copied from class: Component
Makes sure the component is up to date with the current style object

Overrides:
refreshTheme in class Component

getCellRendererComponent

public Component getCellRendererComponent(Component list,
                                          java.lang.Object model,
                                          java.lang.Object value,
                                          int index,
                                          boolean isSelected)
Description copied from interface: CellRenderer
Returns a component instance that is already set to render "value". While it is not a requirement many renderes often derive from a component (such as a label) and return "this". Notice that a null value for the value argument might be sent when refreshing the theme of the list.

Specified by:
getCellRendererComponent in interface CellRenderer
Parameters:
list - the list component
model - the model behind the render
value - the value to render
index - the index in the list
isSelected - whether the entry is selected
Returns:
a component to paint within the list

getListCellRendererComponent

public Component getListCellRendererComponent(List list,
                                              java.lang.Object value,
                                              int index,
                                              boolean isSelected)
Description copied from interface: ListCellRenderer
Returns a component instance that is already set to render "value". While it is not a requirement many renderes often derive from a component (such as a label) and return "this". Notice that a null value for the value argument might be sent when refreshing the theme of the list.

Specified by:
getListCellRendererComponent in interface ListCellRenderer
Parameters:
list - the list component
value - the value to render
index - the index in the list
isSelected - whether the entry is selected
Returns:
a component to paint within the list

getListFocusComponent

public Component getListFocusComponent(List list)
Description copied from interface: ListCellRenderer
Returns a component instance that is painted under the currently focused renderer and is animated to provide smooth scrolling. When the selection moves, this component is drawn above/bellow the list items - it is recommended to give this component some level of transparency (see above code example). This method is optional an implementation can choose to return null.

Specified by:
getListFocusComponent in interface ListCellRenderer
Parameters:
list - the parent list
Returns:
a component to use as focus
See Also:
Component.setSmoothScrolling(boolean)

repaint

public void repaint()
Overriden to do nothing and remove a performance issue where renderer changes perform needless repaint calls

Overrides:
repaint in class Component
See Also:
Display

isShowNumbers

public boolean isShowNumbers()
Indicate whether numbering should exist for the default cell renderer

Returns:
true if numers are shown by the numbers

setShowNumbers

public void setShowNumbers(boolean showNumbers)
Indicate whether numbering should exist for the default cell renderer

Parameters:
showNumbers - indicate whether numbering should exist for the default cell renderer

getSelectionTransparency

public int getSelectionTransparency()
The background transparency factor to apply to the selection focus

Returns:
selection transperancy value

setSelectionTransparency

public void setSelectionTransparency(int selectionTransparency)
The background transparency factor to apply to the selection focus

Parameters:
selectionTransparency - the selection transperancy value

setShowNumbersDefault

public static void setShowNumbersDefault(boolean def)
Inidicates whether the default list cell renderer will show numbers by default when constructed

Parameters:
def - true to show numbers for all renderers created in the future

isShowNumbersDefault

public static boolean isShowNumbersDefault()
Inidicates whether the default list cell renderer will show numbers by default when constructed

Returns:
true when showing numbers, false otherwise

getFocusComponent

public Component getFocusComponent(Component list)
Description copied from interface: CellRenderer
Returns a component instance that is painted under the currently focused renderer and is animated to provide smooth scrolling. When the selection moves, this component is drawn above/bellow the list items - it is recommended to give this component some level of transparency (see above code example). This method is optional an implementation can choose to return null.

Specified by:
getFocusComponent in interface CellRenderer
Parameters:
list - the parent list
Returns:
a component to use as focus
See Also:
Component.setSmoothScrolling(boolean)


Copyright 2011 Oracle Corporation. All rights reserved. Use is subject to license terms.
 
 
Close
loading
Please Confirm
Close