com.citra.table
Class ListRowHeader
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JList
com.citra.table.ListRowHeader
- All Implemented Interfaces:
- RowHeader, ImageObserver, MenuContainer, Serializable, Accessible, Scrollable
public class ListRowHeader
- extends JList
- implements RowHeader
The default RowHeader implementation that uses a JList and a ListCellRenderer.
- See Also:
- Serialized Form
Field Summary |
static int |
ALL_ROWS
constant indicating that all rows will be used in order to compute the row header's width |
protected boolean |
autoUpdateWidth
flag that is true if the width is updated when the contents of the list change |
protected int |
computeWidthMode
the mode according to which the row header's width is computed |
static int |
FIRST_ROW
constant indicating that the first row only will be used in order to compute the row header's width |
static int |
LAST_ROW
constant indicating that the last row only will be used in order to compute the row header's width |
protected int |
minWidth
the minimum width of the row header |
protected JTable |
table
the associated table |
Method Summary |
protected Dimension |
computePreferredDimension(int index)
Determines the preferred size of a specific row in the row header. |
protected int |
computePreferredWidth()
Calculates and returns the row header's preferred width. |
boolean |
getAutoUpdateWidth()
Returns a flag that is true if the list's width is automatically updated
when the contents of the list change. |
Rectangle |
getCellBounds(int index1,
int index2)
Returns the bounds of the specified range of items in JList
coordinates. |
int |
getComputeWidthMode()
Determines the mode according to which the width of the row header is computed. |
int |
getMinWidth()
Determines the minimum width of the row header. |
JTable |
getTable()
Returns the associated table. |
Component |
getView()
Returns the view attached to the RowHeader. |
void |
invalidate()
Invalidates the container. |
void |
setAutoUpdateWidth(boolean autoUpdateWidth)
Assigns a flag that is true if the list's width is automatically updated
when the contents of the list change. |
void |
setComputeWidthMode(int computeWidthMode)
Assigns the mode according to which the width of the row header is computed. |
void |
setMinWidth(int minWidth)
Assigns the minimum width of the row header. |
void |
setModel(ListModel model)
Sets the model that represents the contents or "value" of the
list and clears the list selection after notifying
PropertyChangeListeners . |
void |
setTable(JTable table)
Assigns a table to the rowheader's view component. |
void |
updateUI()
Resets the UI property with the value from the current look and feel. |
Methods inherited from class javax.swing.JList |
addListSelectionListener, addSelectionInterval, clearSelection, createSelectionModel, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellRenderer, getDragEnabled, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
table
protected JTable table
- the associated table
FIRST_ROW
public static final int FIRST_ROW
- constant indicating that the first row only will be used in order to compute the row header's width
- See Also:
- Constant Field Values
LAST_ROW
public static final int LAST_ROW
- constant indicating that the last row only will be used in order to compute the row header's width
- See Also:
- Constant Field Values
ALL_ROWS
public static final int ALL_ROWS
- constant indicating that all rows will be used in order to compute the row header's width
- See Also:
- Constant Field Values
computeWidthMode
protected int computeWidthMode
- the mode according to which the row header's width is computed
minWidth
protected int minWidth
- the minimum width of the row header
autoUpdateWidth
protected boolean autoUpdateWidth
- flag that is true if the width is updated when the contents of the list change
ListRowHeader
public ListRowHeader()
- Creates a ListRowHeader.
ListRowHeader
public ListRowHeader(JTable table)
- Creates a ListRowHeader.
computePreferredDimension
protected Dimension computePreferredDimension(int index)
- Determines the preferred size of a specific row in the row header.
- Parameters:
index
- the row index
- Returns:
- the row's preferred dimension
computePreferredWidth
protected int computePreferredWidth()
- Calculates and returns the row header's preferred width.
The width is calculated according to the computeWidthMode attribute.
The resulting computed width is not less than the list row header's minimum width.
- Returns:
- the row header's preferred width
getAutoUpdateWidth
public boolean getAutoUpdateWidth()
- Returns a flag that is true if the list's width is automatically updated
when the contents of the list change.
If true, the width is evaluated with the
computePreferredWidth
method. The default value is false.
- Returns:
- true, if the width is updated when the contents change, false otherwise
getCellBounds
public Rectangle getCellBounds(int index1,
int index2)
- Returns the bounds of the specified range of items in
JList
coordinates. Returns null
if index isn't valid.
- Overrides:
getCellBounds
in class JList
- Parameters:
index1
- the index of the first JList
cell in the rangeindex2
- the index of the last JList
cell in the range
- Returns:
- the bounds of the indexed cells in pixels
getComputeWidthMode
public int getComputeWidthMode()
- Determines the mode according to which the width of the row header is computed.
Possible values are:
FIRST_ROW: only the first row is used
LAST_ROW: only the last row is used
ALL_ROWS: all rows are used
The default mode is LAST_ROW.
- Returns:
- the mode for computing the width of the row header
getMinWidth
public int getMinWidth()
- Determines the minimum width of the row header.
This value is taken into account when computing the row header's width.
- Returns:
- the minimum width of the row header
getTable
public JTable getTable()
- Returns the associated table.
- Returns:
- the associated table
getView
public Component getView()
- Returns the view attached to the RowHeader.
- Specified by:
getView
in interface RowHeader
- Returns:
- the view
invalidate
public void invalidate()
- Invalidates the container. The container and all parents
above it are marked as needing to be laid out. This method can
be called often, so it needs to execute quickly.
- Overrides:
invalidate
in class Container
- See Also:
Container.validate()
,
Container.layout()
,
LayoutManager
setAutoUpdateWidth
public void setAutoUpdateWidth(boolean autoUpdateWidth)
- Assigns a flag that is true if the list's width is automatically updated
when the contents of the list change.
If true, the width is evaluated with the
computePreferredWidth
method. The default value is false.
- Parameters:
autoUpdateWidth
- true, if the width is updated when the contents change, false otherwise
setComputeWidthMode
public void setComputeWidthMode(int computeWidthMode)
- Assigns the mode according to which the width of the row header is computed.
Possible values are:
FIRST_ROW: only the first row is used
LAST_ROW: only the last row is used
ALL_ROWS: all rows are used
The default mode is LAST_ROW.
- Parameters:
computeWidthMode
- the mode for computing the width of the row header
setMinWidth
public void setMinWidth(int minWidth)
- Assigns the minimum width of the row header.
This value is taken into account when computing the row header's width.
- Parameters:
minWidth
- the minimum width of the row header
setModel
public void setModel(ListModel model)
- Sets the model that represents the contents or "value" of the
list and clears the list selection after notifying
PropertyChangeListeners
.
This is a JavaBeans bound property.
- Overrides:
setModel
in class JList
- Parameters:
model
- the ListModel
that provides the
list of items for display- See Also:
JList.getModel()
setTable
public void setTable(JTable table)
- Assigns a table to the rowheader's view component.
- Specified by:
setTable
in interface RowHeader
- Parameters:
table
- the table to assign
updateUI
public void updateUI()
- Resets the UI property with the value from the current look and feel.
- Overrides:
updateUI
in class JList
- See Also:
UIManager.getUI(javax.swing.JComponent)