public class FTableImageColumnRenderer extends FTableColumnRenderer
FTableColumnRenderer
that is specifically
designed to render images within a table column.
This renderer is responsible for displaying images. It handles the asynchronous loading of images to prevent the UI from freezing. It uses a "delayed image load" strategy where a placeholder is initially displayed, and the actual image is loaded in the background.
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
FTableImageColumnRenderer(FTableColumn col)
Constructs a new
FTableImageColumnRenderer . |
Modifier and Type | Method and Description |
---|---|
void |
delayedImageLoad(Bild image,
int row,
int column,
int width,
int height)
Initiates a delayed, asynchronous load of an image for a specific cell.
|
void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
This method is a no-operation override from "Component" to prevent
property change events from being fired, as they are not needed for
this renderer.
|
java.awt.Component |
getTableCellRendererComponent(javax.swing.JTable table,
java.lang.Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
Returns the component used for rendering the cell.
|
void |
setValue(java.lang.Object value,
int row,
int column)
Sets the value of the cell, initiating a delayed image load if the value is
a valid
Bild object. |
close, firePropertyChange, getBackgroundForRow, getErrorBackgroundForRow, getForegroundForRow, getFTableConfiguration, getLoadingBackgroundForRow, isOpaque, repaint, repaint, revalidate, updateUI, validate
correctHTMLSizing, fitsWithinCurrentSize, getBaseline, getCornerPosition, getGradientStartColor, getGradientStopColor, getMinimumSize, getPreferredSize, getRenderingHints, init, isClickable, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, paintComponent, setBackground, setClickable, setExplicitArc, setGradientStartColor, setGradientStartPosition, setGradientStopColor, setGradientStopPosition, setIcon, setSize, setSize, setText, setText, syncWidthWith
getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setUI, setVerticalAlignment, setVerticalTextPosition
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, 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, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle
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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFont, setFont
public FTableImageColumnRenderer(FTableColumn col)
FTableImageColumnRenderer
.col
- The FTableColumn
to which this renderer is bound.public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int column)
This method configures the renderer component with the necessary values,
such as font, value, and selection status, and returns it for display.
The actual value is set by the setValue(Object, int, int)
method.
getTableCellRendererComponent
in interface javax.swing.table.TableCellRenderer
getTableCellRendererComponent
in class FTableColumnRenderer
table
- The JTable
the renderer is being configured for.value
- The value of the cell to be rendered.isSelected
- true
if the cell is selected.hasFocus
- true
if the cell has focus.row
- The row index of the cell.column
- The column index of the cell.Component
for rendering the cell.public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
firePropertyChange
in class java.awt.Component
public void setValue(java.lang.Object value, int row, int column)
Bild
object.value
- The value of the cell.row
- The row index of the cell.column
- The column index of the cell.public void delayedImageLoad(Bild image, int row, int column, int width, int height)
This method is typically called by the renderer to load an image from a
Bild
object in the background. It first checks if the cell is still
visible. If it is, it initiates the lazy loading of the image icon from the
Bild
object. Once the image is loaded, it queues a cell update event
for the corresponding row and column on the model, which will trigger a repaint
of the cell with the newly loaded image.
This approach prevents the UI thread from being blocked by I/O operations, ensuring a responsive user experience, especially when dealing with large or a large number of images.
image
- The Bild
Business Object containing the image data to be loaded.row
- The view row index of the cell.column
- The view column index of the cell.width
- The desired width of the image icon.height
- The desired height of the image icon.Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.