Class BaseTableWithButtons
-
- All Implemented Interfaces:
SpreadSheetSupporter,JTableSupporter<BaseTable>,ImageObserver,MenuContainer,Serializable,Accessible
- Direct Known Subclasses:
DataTableWithButtons,SpreadSheetTableWithButtons
public class BaseTableWithButtons extends AbstractDoubleClickableComponentWithButtons<BaseTable> implements SpreadSheetSupporter, JTableSupporter<BaseTable>
Graphical component that consists of a BaseTable with buttons on the right-hand side.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected TableModelListenerm_CountModelListenerthe model listener for updating the counts.-
Fields inherited from class adams.gui.core.AbstractDoubleClickableComponentWithButtons
m_DoubleClickAction, m_DoubleClickButton
-
Fields inherited from class adams.gui.core.AbstractComponentWithButtons
m_Component, m_LabelInfo, m_PanelAll, m_PanelInfo, m_ScrollPane
-
Fields inherited from class adams.gui.core.BasePanelWithButtons
m_LayoutButtons, m_PanelButtons
-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors Constructor Description BaseTableWithButtons()The default constructor.BaseTableWithButtons(TableModel model)Initializes the table with the specified model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCellPopupMenuListener(PopupMenuListener l)Adds the popup menu listeners for the cell.voidaddHeaderPopupMenuListener(PopupMenuListener l)Adds the popup menu listeners for the header.voidaddRemoveItemsListener(RemoveItemsListener l)Adds the remove items listener to its internal list.booleancanMoveDown()checks whether the selected items can be moved down.booleancanMoveUp()checks whether the selected items can be moved up.protected BaseTablecreateComponent()Creates the component to use in the panel.intgetAutoResizeMode()Returns the auto resize mode of the table.Class<?>getColumnClass(int column)Returns the type of the column appearing in the view at column positioncolumn.intgetColumnCount()Returns the number of columns in the column model.TableColumnModelgetColumnModel()Returns theTableColumnModelthat contains all column information of this table.StringgetColumnName(int column)Returns the name of the column appearing in the view at column positioncolumn.int[]getColumnWidths()Returns the column widths.TableModelgetModel()Returns the underlying table model.intgetRowCount()Returns the number of rows that can be shown in theJTable, given unlimited space.intgetRowHeight(int row)Returns the height for the specified row.intgetSelectedColumn()Returns the index of the first selected column, -1 if no column is selected.intgetSelectedColumnCount()Returns the number of selected columns.int[]getSelectedColumns()Returns the indices of all selected columns.intgetSelectedRow()Returns the index of the first selected row, -1 if no row is selected.intgetSelectedRowCount()Returns the number of selected rows.int[]getSelectedRows()Returns the indices of all selected rows.ListSelectionModelgetSelectionModel()Returns theListSelectionModelthat is used to maintain row selection state.booleangetShowSimpleCellPopupMenu()Returns whether to show a simple cell popup menu.booleangetShowSimpleHeaderPopupMenu()Returns whether to show a simple header popup menu.BaseTablegetTable()Returns the underlying table.ObjectgetValueAt(int row, int column)Returns the cell value atrowandcolumn.booleanisCellEditable(int row, int column)Returns true if the cell atrowandcolumnis editable.booleanisCellSelected(int row, int column)Returns true if the specified indices are in the valid range of rows and columns and the cell at the specified position is selected.booleanisColumnSelected(int column)Returns true if the specified index is in the valid range of columns, and the column at that index is selected.booleanisRowSelected(int row)Returns true if the specified index is in the valid range of rows, and the row at that index is selected.protected booleanisValidDoubleClick(MouseEvent e)Checks whether the double click is valid for this component.voidmoveBottom()moves the selected items to the end.voidmoveDown()moves the selected items down by 1.voidmoveTop()moves the selected items to the top.voidmoveUp()moves the selected items up by 1.voidremoveCellPopupMenuListener(PopupMenuListener l)Removes the popup menu listener for the cell from its internal list.voidremoveHeaderPopupMenuListener(PopupMenuListener l)Removes the popup menu listener for the header from its internal list.voidremoveRemoveItemsListener(RemoveItemsListener l)Removes the remove items listener from its internal list.booleanrequiresScrollPane()Returns whether the component requires a JScrollPane around it.introwAtPoint(Point point)Returns the index of the row thatpointlies in, or -1 if the result is not in the range [0,getRowCount()-1].voidscrollColumnToVisible(int col)Scrolls the column into view.voidscrollRowToVisible(int row)Scrolls the row into view.voidsetAutoResizeMode(int mode)Sets the table's auto resize mode when the table is resized.voidsetColumnModel(TableColumnModel columnModel)Sets the column model for this table tonewModeland registers for listener notifications from the new column model.voidsetColumnWidths(int[] value)Sets the column widths.voidsetInfoVisible(boolean value)Whether to display the information JLabel or not.voidsetModel(TableModel dataModel)Sets the data model for this table tonewModeland registers with it for listener notifications from the new data model.voidsetOptimalColumnWidth()Sets the optimal column width for all columns.voidsetOptimalColumnWidth(int column)Sets the optimal column width for the specified column.voidsetOptimalColumnWidthBounded(int max)Sets the optimal column width for all columns.voidsetOptimalColumnWidthBounded(int column, int max)Sets the optimal column width for the specified column.voidsetRowHeight(int rowHeight)Sets the height, in pixels, of all cells torowHeight, revalidates, and repaints.voidsetSelectedRow(int row)Sets the selected row (clears all others).voidsetSelectedRows(int[] rows)Sets the selected rows (clears all others).voidsetSelectionMode(int selectionMode)Sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals.voidsetSelectionModel(ListSelectionModel newModel)Sets the row selection model for this table tonewModeland registers for listener notifications from the new selection model.voidsetShowSimpleCellPopupMenu(boolean value)Sets whether to show a simple cell popup menu.voidsetShowSimpleHeaderPopupMenu(boolean value)Sets whether to show a simple header popup menu.voidsetShowSimplePopupMenus(boolean value)Sets whether to show a simple header/cell popup menu.voidsetValueAt(Object aValue, int row, int column)Sets the value for the cell in the table model atrowandcolumn.voidshowCell(int row, int column)Displays the specified cell.booleansupportsMovingRows()Returns whether the table model supports moving of rows.SpreadSheettoSpreadSheet()Returns the content as spreadsheet.protected voidupdateCounts()Updates the information about the counts.protected voidupdateCountsModelListener(TableModel dataModel)Updates the table model's listener for updating the counts.-
Methods inherited from class adams.gui.core.AbstractDoubleClickableComponentWithButtons
getDoubleClickAction, getDoubleClickButton, initGUI, setDoubleClickAction, setDoubleClickButton
-
Methods inherited from class adams.gui.core.AbstractComponentWithButtons
addKeyListener, getComponent, getScrollPane, isInfoVisible, removeKeyListener, updateInfo
-
Methods inherited from class adams.gui.core.BasePanelWithButtons
addToButtonsPanel, clearButtonsPanel, removeFromButtonsPanel
-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, initialize, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
m_CountModelListener
protected TableModelListener m_CountModelListener
the model listener for updating the counts.
-
-
Constructor Detail
-
BaseTableWithButtons
public BaseTableWithButtons()
The default constructor.
-
BaseTableWithButtons
public BaseTableWithButtons(TableModel model)
Initializes the table with the specified model.- Parameters:
model- the model to use
-
-
Method Detail
-
requiresScrollPane
public boolean requiresScrollPane()
Returns whether the component requires a JScrollPane around it.- Specified by:
requiresScrollPanein classAbstractComponentWithButtons<BaseTable>- Returns:
- true if the component requires a JScrollPane
-
createComponent
protected BaseTable createComponent()
Creates the component to use in the panel. If a- Specified by:
createComponentin classAbstractComponentWithButtons<BaseTable>- Returns:
- the component
-
isValidDoubleClick
protected boolean isValidDoubleClick(MouseEvent e)
Checks whether the double click is valid for this component.- Specified by:
isValidDoubleClickin classAbstractDoubleClickableComponentWithButtons<BaseTable>- Parameters:
e- the mouse event of the double click- Returns:
- true if valid double click
-
setModel
public void setModel(TableModel dataModel)
Sets the data model for this table tonewModeland registers with it for listener notifications from the new data model.- Parameters:
dataModel- the new data source for this table- See Also:
getModel()
-
getModel
public TableModel getModel()
Returns the underlying table model.- Returns:
- the underlying table model
-
supportsMovingRows
public boolean supportsMovingRows()
Returns whether the table model supports moving of rows.- Returns:
- true if the model supports moving rows around
- See Also:
MoveableTableModel
-
moveUp
public void moveUp()
moves the selected items up by 1.
-
moveDown
public void moveDown()
moves the selected items down by 1.
-
moveTop
public void moveTop()
moves the selected items to the top.
-
moveBottom
public void moveBottom()
moves the selected items to the end.
-
canMoveUp
public boolean canMoveUp()
checks whether the selected items can be moved up.- Returns:
- true if the selected items can be moved
-
canMoveDown
public boolean canMoveDown()
checks whether the selected items can be moved down.- Returns:
- true if the selected items can be moved
-
setColumnModel
public void setColumnModel(TableColumnModel columnModel)
Sets the column model for this table tonewModeland registers for listener notifications from the new column model. Also sets the column model of theJTableHeadertocolumnModel.- Parameters:
columnModel- the new data source for this table- Throws:
IllegalArgumentException- ifcolumnModelisnull- See Also:
getColumnModel()
-
getColumnModel
public TableColumnModel getColumnModel()
Returns theTableColumnModelthat contains all column information of this table.- Returns:
- the object that provides the column state of the table
- See Also:
setColumnModel(javax.swing.table.TableColumnModel)
-
setSelectionModel
public void setSelectionModel(ListSelectionModel newModel)
Sets the row selection model for this table tonewModeland registers for listener notifications from the new selection model.- Parameters:
newModel- the new selection model- Throws:
IllegalArgumentException- ifnewModelisnull- See Also:
getSelectionModel()
-
getSelectionModel
public ListSelectionModel getSelectionModel()
Returns theListSelectionModelthat is used to maintain row selection state.- Returns:
- the object that provides row selection state,
nullif row selection is not allowed - See Also:
setSelectionModel(javax.swing.ListSelectionModel)
-
setAutoResizeMode
public void setAutoResizeMode(int mode)
Sets the table's auto resize mode when the table is resized.- Parameters:
mode- One of 5 legal values: AUTO_RESIZE_OFF, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_SUBSEQUENT_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_ALL_COLUMNS- See Also:
getAutoResizeMode(),Container.doLayout()
-
getAutoResizeMode
public int getAutoResizeMode()
Returns the auto resize mode of the table. The default mode is AUTO_RESIZE_SUBSEQUENT_COLUMNS.- Returns:
- the autoResizeMode of the table
- See Also:
setAutoResizeMode(int)
-
setOptimalColumnWidth
public void setOptimalColumnWidth()
Sets the optimal column width for all columns. AutoResize must be set to BaseTable.AUTO_RESIZE_OFF.
-
setOptimalColumnWidthBounded
public void setOptimalColumnWidthBounded(int max)
Sets the optimal column width for all columns. AutoResize must be set to BaseTable.AUTO_RESIZE_OFF.- Parameters:
max- the maximum width
-
setOptimalColumnWidth
public void setOptimalColumnWidth(int column)
Sets the optimal column width for the specified column. AutoResize must be set to BaseTable.AUTO_RESIZE_OFF.- Parameters:
column- the column to resize
-
setOptimalColumnWidthBounded
public void setOptimalColumnWidthBounded(int column, int max)Sets the optimal column width for the specified column. AutoResize must be set to BaseTable.AUTO_RESIZE_OFF.- Parameters:
column- the column to resizemax- the maximum width
-
setRowHeight
public void setRowHeight(int rowHeight)
Sets the height, in pixels, of all cells torowHeight, revalidates, and repaints. The height of the cells will be equal to the row height minus the row margin.- Parameters:
rowHeight- new row height
-
getRowHeight
public int getRowHeight(int row)
Returns the height for the specified row.- Parameters:
row- the row to get the height in pixels for- Returns:
- the row height
-
rowAtPoint
public int rowAtPoint(Point point)
Returns the index of the row thatpointlies in, or -1 if the result is not in the range [0,getRowCount()-1].- Parameters:
point- the location of interest- Returns:
- the index of the row that
pointlies in, or -1 if the result is not in the range [0,getRowCount()-1]
-
getSelectedRow
public int getSelectedRow()
Returns the index of the first selected row, -1 if no row is selected.- Returns:
- the index of the first selected row
-
getSelectedColumn
public int getSelectedColumn()
Returns the index of the first selected column, -1 if no column is selected.- Returns:
- the index of the first selected column
-
getSelectedRows
public int[] getSelectedRows()
Returns the indices of all selected rows.- Returns:
- an array of integers containing the indices of all selected rows, or an empty array if no row is selected
- See Also:
getSelectedRow()
-
setSelectedRow
public void setSelectedRow(int row)
Sets the selected row (clears all others).- Parameters:
row- the row to select
-
setSelectedRows
public void setSelectedRows(int[] rows)
Sets the selected rows (clears all others).- Parameters:
rows- the rows to select
-
getSelectedColumns
public int[] getSelectedColumns()
Returns the indices of all selected columns.- Returns:
- an array of integers containing the indices of all selected columns, or an empty array if no column is selected
- See Also:
getSelectedColumn()
-
getSelectedRowCount
public int getSelectedRowCount()
Returns the number of selected rows.- Returns:
- the number of selected rows, 0 if no rows are selected
-
getSelectedColumnCount
public int getSelectedColumnCount()
Returns the number of selected columns.- Returns:
- the number of selected columns, 0 if no columns are selected
-
isRowSelected
public boolean isRowSelected(int row)
Returns true if the specified index is in the valid range of rows, and the row at that index is selected.- Returns:
- true if
rowis a valid index and the row at that index is selected (where 0 is the first row)
-
isColumnSelected
public boolean isColumnSelected(int column)
Returns true if the specified index is in the valid range of columns, and the column at that index is selected.- Parameters:
column- the column in the column model- Returns:
- true if
columnis a valid index and the column at that index is selected (where 0 is the first column)
-
isCellSelected
public boolean isCellSelected(int row, int column)Returns true if the specified indices are in the valid range of rows and columns and the cell at the specified position is selected.- Parameters:
row- the row being queriedcolumn- the column being queried- Returns:
- true if
rowandcolumnare valid indices and the cell at index(row, column)is selected, where the first row and first column are at index 0
-
scrollRowToVisible
public void scrollRowToVisible(int row)
Scrolls the row into view.- Parameters:
row- the row to scroll into view
-
scrollColumnToVisible
public void scrollColumnToVisible(int col)
Scrolls the column into view.- Parameters:
col- the column to scroll into view
-
getRowCount
public int getRowCount()
Returns the number of rows that can be shown in theJTable, given unlimited space. If aRowSorterwith a filter has been specified, the number of rows returned may differ from that of the underlyingTableModel.- Returns:
- the number of rows shown in the
JTable - See Also:
getColumnCount()
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the column model. Note that this may be different from the number of columns in the table model.- Returns:
- the number of columns in the table
- See Also:
getRowCount()
-
getColumnName
public String getColumnName(int column)
Returns the name of the column appearing in the view at column positioncolumn.- Parameters:
column- the column in the view being queried- Returns:
- the name of the column at position
columnin the view where the first column is column 0
-
getColumnClass
public Class<?> getColumnClass(int column)
Returns the type of the column appearing in the view at column positioncolumn.- Parameters:
column- the column in the view being queried- Returns:
- the type of the column at position
columnin the view where the first column is column 0
-
getValueAt
public Object getValueAt(int row, int column)
Returns the cell value atrowandcolumn.Note: The column is specified in the table view's display order, and not in the
TableModel's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering.- Parameters:
row- the row whose value is to be queriedcolumn- the column whose value is to be queried- Returns:
- the Object at the specified cell
-
setValueAt
public void setValueAt(Object aValue, int row, int column)
Sets the value for the cell in the table model atrowandcolumn.Note: The column is specified in the table view's display order, and not in the
TableModel's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering.aValueis the new value.- Parameters:
aValue- the new valuerow- the row of the cell to be changedcolumn- the column of the cell to be changed- See Also:
getValueAt(int, int)
-
isCellEditable
public boolean isCellEditable(int row, int column)Returns true if the cell atrowandcolumnis editable. Otherwise, invokingsetValueAton the cell will have no effect.Note: The column is specified in the table view's display order, and not in the
TableModel's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering.- Parameters:
row- the row whose value is to be queriedcolumn- the column whose value is to be queried- Returns:
- true if the cell is editable
- See Also:
setValueAt(java.lang.Object, int, int)
-
setSelectionMode
public void setSelectionMode(int selectionMode)
Sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals.- Parameters:
selectionMode- the selection mode to use- See Also:
JList.setSelectionMode(int)
-
addRemoveItemsListener
public void addRemoveItemsListener(RemoveItemsListener l)
Adds the remove items listener to its internal list.- Parameters:
l- the listener to add
-
removeRemoveItemsListener
public void removeRemoveItemsListener(RemoveItemsListener l)
Removes the remove items listener from its internal list.- Parameters:
l- the listener to remove
-
setInfoVisible
public void setInfoVisible(boolean value)
Whether to display the information JLabel or not.- Overrides:
setInfoVisiblein classAbstractComponentWithButtons<BaseTable>- Parameters:
value- if true then the information is being displayed
-
updateCountsModelListener
protected void updateCountsModelListener(TableModel dataModel)
Updates the table model's listener for updating the counts.- Parameters:
dataModel- the model to update
-
updateCounts
protected void updateCounts()
Updates the information about the counts.
-
showCell
public void showCell(int row, int column)Displays the specified cell.- Parameters:
row- the row of the cellcolumn- the column of the cell
-
setShowSimplePopupMenus
public void setShowSimplePopupMenus(boolean value)
Sets whether to show a simple header/cell popup menu.- Parameters:
value- true if to show menus
-
setShowSimpleHeaderPopupMenu
public void setShowSimpleHeaderPopupMenu(boolean value)
Sets whether to show a simple header popup menu.- Parameters:
value- true if to show menu
-
getShowSimpleHeaderPopupMenu
public boolean getShowSimpleHeaderPopupMenu()
Returns whether to show a simple header popup menu.- Returns:
- true if to show menu
-
setShowSimpleCellPopupMenu
public void setShowSimpleCellPopupMenu(boolean value)
Sets whether to show a simple cell popup menu.- Parameters:
value- true if to show menu
-
getShowSimpleCellPopupMenu
public boolean getShowSimpleCellPopupMenu()
Returns whether to show a simple cell popup menu.- Returns:
- true if to show menu
-
addHeaderPopupMenuListener
public void addHeaderPopupMenuListener(PopupMenuListener l)
Adds the popup menu listeners for the header.- Parameters:
l- the listener to add
-
removeHeaderPopupMenuListener
public void removeHeaderPopupMenuListener(PopupMenuListener l)
Removes the popup menu listener for the header from its internal list.- Parameters:
l- the listener to remove
-
addCellPopupMenuListener
public void addCellPopupMenuListener(PopupMenuListener l)
Adds the popup menu listeners for the cell.- Parameters:
l- the listener to add
-
removeCellPopupMenuListener
public void removeCellPopupMenuListener(PopupMenuListener l)
Removes the popup menu listener for the cell from its internal list.- Parameters:
l- the listener to remove
-
toSpreadSheet
public SpreadSheet toSpreadSheet()
Returns the content as spreadsheet.- Specified by:
toSpreadSheetin interfaceSpreadSheetSupporter- Returns:
- the content
-
getColumnWidths
public int[] getColumnWidths()
Returns the column widths.- Returns:
- the current widths
-
setColumnWidths
public void setColumnWidths(int[] value)
Sets the column widths.- Parameters:
value- the widths
-
getTable
public BaseTable getTable()
Returns the underlying table.- Specified by:
getTablein interfaceJTableSupporter<BaseTable>- Returns:
- the table
-
-