|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
be.ugent.caagt.swirl.lists.CellList
public class CellList
List component in which list items are layed out as cells in a grid.
The functionality is the same
as that of JList except for the following:
getSelectedValue()
and getSelectedValues().cellRenderer delegate of type
CellListCellRenderer to paint the visible cells in the list
and to obtain the correct tool tip information for that cell.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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 java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
CellList(javax.swing.ListModel dataModel,
int cellWidth,
int cellHeight,
int numberOfColumns)
Construct a list of this type for the given model, with the given cell size. |
|
| Method Summary | |
|---|---|
void |
contentsChanged(javax.swing.event.ListDataEvent e)
|
void |
doLayout()
|
void |
ensureIndexIsVisible(int index)
Scrolls the viewport to make the specified cell completely visible. |
java.awt.Rectangle |
getCellBounds(int index0,
int index1)
Returns the bounds of the specified range of items in component coordinates.Returns null if index isn't valid. |
int |
getCellHeight()
Height of a grid cell. |
CellListCellRenderer |
getCellRenderer()
Return the cell renderer used by this list. |
int |
getCellWidth()
Width of a grid cell. |
java.awt.Point |
getDropLocation()
Return the last drag-and-drop location where this component is a target. |
java.awt.Dimension |
getMinimumSize()
|
javax.swing.ListModel |
getModel()
Return the current data model. |
java.awt.Dimension |
getPreferredScrollableViewportSize()
|
java.awt.Dimension |
getPreferredSize()
|
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Returns the distance to scroll vertically to expose the next or previous block. |
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Returns the distance to scroll vertically to expose the next or previous row. |
java.lang.Object |
getSelectedValue()
Returns the first selected value, or null if the
selection is empty. |
java.lang.Object[] |
getSelectedValues()
Returns an array of the values for the selected cells. |
javax.swing.ListSelectionModel |
getSelectionModel()
Return the current selection model. |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent event)
Overrides JComponent's getToolTipText
method in order to allow the renderer's tips to be used
if it has text set. |
java.awt.Point |
indexToLocation(int index)
Return the top left coordinate of the cell with given index, or null if the index is not valid. |
void |
initActionMap()
Initialize the action map. |
void |
intervalAdded(javax.swing.event.ListDataEvent e)
|
void |
intervalRemoved(javax.swing.event.ListDataEvent e)
|
boolean |
isDragEnabled()
Is dragging on this component enabled? |
boolean |
isDropInProgress()
Is a drag-and-drop operation in progress where this component is a target? |
int |
locationToIndex(java.awt.Point location)
Convert a point in component coordinates to the index of the cell at that location, or -1 if there is no such cell. |
protected void |
paintComponent(java.awt.Graphics g)
|
void |
setCellHeight(int cellHeight)
Set the height of a grid cell. |
void |
setCellRenderer(CellListCellRenderer cellRenderer)
Set the cell renderer. |
void |
setCellSize(int cellWidth,
int cellHeight)
Set width and height of a grid cell. |
void |
setCellWidth(int cellWidth)
Set the width of a grid cell. |
void |
setDragEnabled(boolean dragEnabled)
Indicate whether dragging on this component should be enabled. |
void |
setDropTarget(java.awt.dnd.DropTarget dt)
|
void |
setModel(javax.swing.ListModel model)
Sets a new data model and clears the selection. |
void |
setNumberOfColumns(int numberOfColumns)
Set the number of columns to use in this list. |
void |
setSelectionModel(javax.swing.ListSelectionModel selectionModel)
Set or change the selection model. |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, 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, 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, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CellList(javax.swing.ListModel dataModel,
int cellWidth,
int cellHeight,
int numberOfColumns)
cellWidth - width of every grid cellcellHeight - height of every grid cellnumberOfColumns - initial number of columns| Method Detail |
|---|
public void setNumberOfColumns(int numberOfColumns)
numberOfColumns - New value of property numberOfColumns.public int getCellWidth()
public void setCellWidth(int cellWidth)
cellWidth - New value of property cellWidth.public int getCellHeight()
public void setCellHeight(int cellHeight)
cellHeight - New value of property cellHeight.public javax.swing.ListSelectionModel getSelectionModel()
public void setCellSize(int cellWidth,
int cellHeight)
cellWidth - New value of property cellWidth.cellHeight - New value of property cellHeight.public final void setSelectionModel(javax.swing.ListSelectionModel selectionModel)
public javax.swing.ListModel getModel()
public void setModel(javax.swing.ListModel model)
public CellListCellRenderer getCellRenderer()
public void setCellRenderer(CellListCellRenderer cellRenderer)
public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
JComponent's getToolTipText
method in order to allow the renderer's tips to be used
if it has text set.
getToolTipText in class javax.swing.JComponentJComponent.getToolTipText()public int locationToIndex(java.awt.Point location)
public java.awt.Point indexToLocation(int index)
null if the index is not valid.
public java.awt.Rectangle getCellBounds(int index0,
int index1)
null if index isn't valid.
index0 - the index of the first cell in the rangeindex1 - the index of the last cell in the range
protected void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentpublic void doLayout()
doLayout in class java.awt.Containerpublic java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentpublic java.awt.Dimension getMinimumSize()
getMinimumSize in class javax.swing.JComponentpublic void ensureIndexIsVisible(int index)
index - the index of the cell to make visiblepublic java.lang.Object[] getSelectedValues()
public java.lang.Object getSelectedValue()
null if the
selection is empty.
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
getScrollableUnitIncrement in interface javax.swing.Scrollable
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
getScrollableBlockIncrement in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight in interface javax.swing.Scrollablepublic java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface javax.swing.Scrollablepublic void intervalRemoved(javax.swing.event.ListDataEvent e)
intervalRemoved in interface javax.swing.event.ListDataListenerpublic void intervalAdded(javax.swing.event.ListDataEvent e)
intervalAdded in interface javax.swing.event.ListDataListenerpublic void contentsChanged(javax.swing.event.ListDataEvent e)
contentsChanged in interface javax.swing.event.ListDataListenerpublic final void initActionMap()
public void setDragEnabled(boolean dragEnabled)
public boolean isDragEnabled()
public boolean isDropInProgress()
public java.awt.Point getDropLocation()
public void setDropTarget(java.awt.dnd.DropTarget dt)
setDropTarget in class java.awt.Component
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||