JIDE 3.5.15

com.jidesoft.pivot
Class AggregateTable

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by com.jidesoft.grid.JideTable
                      extended by com.jidesoft.grid.ContextSensitiveTable
                          extended by com.jidesoft.grid.NavigableTable
                              extended by com.jidesoft.grid.CellStyleTable
                                  extended by com.jidesoft.grid.CellSpanTable
                                      extended by com.jidesoft.grid.CategorizedTable
                                          extended by com.jidesoft.grid.SortableTable
                                              extended by com.jidesoft.pivot.AggregateTable
All Implemented Interfaces:
ExpandableProvider, GroupHeaderTableProvider, IndexChangeListener, SortListener, TableAdapter, ValueStringAdjustProvider, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable

public class AggregateTable
extends SortableTable
implements ExpandableProvider, ValueStringAdjustProvider, GroupHeaderTableProvider

AggregateTable provides a way to aggregate a table model with duplicated values using a TreeTable-like expandable cells and cell spans.

If you have a very huge table and observe obvious performance issue while scrolling. You could use the following code to enhance the performance. Of course, you have to prepare for huge memory usage for the cache. That's why we didn't put it on JIDE jar.

         // After you create the AggregateTable instance, you can add a CachedTableModel wrapper to improve the
 performance.
         _aggregateTable.setModel(new CachedTableModel(_aggregateTable.getModel()));
 

See Also:
Serialized Form

Nested Class Summary
protected  class AggregateTable.DelegateExpandMouseInputListener
           
 class AggregateTable.DraggingHandler
           
protected  class AggregateTable.ExpandMouseListener
           
static interface AggregateTable.PopupMenuCustomizer
          Popup menu customizer interface without row index and column index as input.
static interface AggregateTable.TablePopupMenuCustomizer
          Popup menu customizer interface with row index and column index as input.
 
Nested classes/interfaces inherited from class com.jidesoft.grid.CellSpanTable
CellSpanTable.DelegateAction
 
Nested classes/interfaces inherited from class com.jidesoft.grid.JideTable
JideTable.NonContiguousTransferHandler
 
Nested classes/interfaces inherited from class javax.swing.JTable
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode
 
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
static String PROPERTY_DOUBLE_CLICK_ENABLED
           
 
Fields inherited from class com.jidesoft.grid.SortableTable
MULTICOLUMN_SORTABLE_PROPERTY, PROPERTY_SHOW_SORT_ORDER_NUMBER, SORTABLE_PROPERTY
 
Fields inherited from class com.jidesoft.grid.CategorizedTable
DEFAULT_ASCENDING_ICON, DEFAULT_DESCENDING_ICON, PROPERTY_EXPAND_ICON_VISIBLE
 
Fields inherited from class com.jidesoft.grid.CellSpanTable
AUTO_CELL_MERGE_COLUMNS, AUTO_CELL_MERGE_COLUMNS_LIMITED, AUTO_CELL_MERGE_OFF, AUTO_CELL_MERGE_ROWS, AUTO_CELL_MERGE_ROWS_LIMITED, PROPERTY_AUTO_CONVERT_CELL_SPAN, PROPERTY_PAINT_CELL_SPAN_AS_SELECTED
 
Fields inherited from class com.jidesoft.grid.CellStyleTable
_cellStyleList, PROPERTY_FILLS_SELECTION, PROPERTY_FILLS_VIEWPORT_WITH_STRIPE
 
Fields inherited from class com.jidesoft.grid.JideTable
_batchProcessing, _cellChangeEvent, _clickCountToStart, _columnAutoResizer, _columnResizer, _headerDraggingMouseMotionListener, _rolloverCellEditor, _rolloverCellEditorListener, _rolloverColumn, _rolloverEditorComp, _rolloverEditorRemover, _rolloverRow, _rowHeights, _rowResizer, ACTION_NAME_CANCEL_EDITING, AUTO_RESIZE_ALL_COLUMNS_FILL, AUTO_RESIZE_FILL, AUTO_RESIZE_LAST_COLUMN_FILL, AUTO_RESIZE_NEXT_COLUMN_FILL, AUTO_RESIZE_SUBSEQUENT_COLUMNS_FILL, CLIENT_PROPERTY_LAZY_CALCULATE_ROW_HEIGHT, EDITOR_AUTO_COMPLETION_MODE_COLUMN, EDITOR_AUTO_COMPLETION_MODE_NONE, EDITOR_AUTO_COMPLETION_MODE_ROW, EDITOR_AUTO_COMPLETION_MODE_TABLE, PROPERTY_CLEAR_SELECTION_ON_TABLE_DATA_CHANGES, PROPERTY_EDITOR_AUTO_COMPLETION_MODE, PROPERTY_FILLS_BOTTOM, PROPERTY_FILLS_GRIDS, PROPERTY_FILLS_RIGHT, PROPERTY_LOAD_SELECTION_ON_TABLE_DATA_CHANGES, PROPERTY_NON_CONTIGUOUS_CELL_SELECTION, PROPERTY_ROW_AUTO_RESIZES, PROPERTY_SCROLL_ROW_WHEN_ROW_HEIGHT_CHANGES, PROPERTY_TABLE_SELECTION_MODEL, ROW_AUTO_RESIZES_PROPERTY
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
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
AggregateTable()
          Creates an empty AggregateTable.
AggregateTable(TableModel model)
          Creates an AggregateTable.
 
Method Summary
 void aggregate()
          Aggregates the table model.
 void aggregate(int[] columns)
          Aggregates the specified columns.
 void aggregate(String[] columnNames)
          Aggregates the specified columns.
 void collapse(int rowIndex, int columnIndex)
          Collapses the cell.
 void collapseAll()
          Collapses all the cells.
protected  TableCellRenderer createCellRenderer()
          Creates the special cell renderer for the first column which paints +/- icon and tree line.
protected  AggregateTable.DraggingHandler createDraggingColumnPropertyChangeListener()
          Creates the TableColumnModelListener used to handle column rearrangement.
protected  MouseInputListener createExpandMouseInputListener(MouseInputListener listener)
          Creates the mouse listener used to handle mouse click on +/- icon.
protected  MouseListener createExpandMouseListener()
          Creates the mouse listener used to handle mouse click on +/- icon.
protected  ISortableTableModel createSortableTableModel(TableModel model)
          Creates a SortableTableModel that wraps around the actual model.
 boolean editCellAt(int row, int column, EventObject o)
          Overrides so that clicking in the +/- icon area will not start editing the cell.
 void expand(int rowIndex, int columnIndex)
          Expands the cell.
 void expandAll()
          Expands all the cells.
 AggregateTableModel getAggregateTableModel()
          Gets the AggregateTableModel for this table.
 AggregateTable.PopupMenuCustomizer getCellPopupMenuCustomizer()
          Gets the popup menu customizer to customize the menu when user right click on the cells on aggregated column.
 TableCellRenderer getCellRenderer(int rowIndex, int columnIndex)
          Returns an appropriate renderer for the cell specified by this row and column.
 Expandable getExpandableAt(int rowIndex, int columnIndex)
           
 HeaderTableModel getHeaderTableModel()
          This is an interface for HeaderTableCellRenderer so that it can find the correct HeaderTableModel.
 String getResourceString(String key)
          Gets the resource string used in AggregateTable.
 String getTableHeaderToolTipText(int modelIndex)
          Gets the TableHeader's tooltip for a particular model column index
 String getTableHeaderToolTipText(MouseEvent event)
          Gets the TableHeader's tooltip at the location of mouse event.
 String getValueAtInString(int rowIndex, int columnIndex, ValueConverter converter)
          Gets the string value with summary name or the total/grand total.
 String getVersion()
          Gets an optional version string.
protected  void handleMouseEvent(MouseEvent e)
          Handles the mouse event.
 boolean isAutoAdjustGrouping()
          Gets the grouping behavior when dragging columns.
 boolean isAutoGrouping()
          Gets the flag if we should group the column if dragging the column to the very beginning of the table when there is no grouping.
 boolean isExpandIconVisible(Node node)
          Checks if the +/- icon should visible for the node.
 boolean isShowContextMenu()
          Gets the flag indicating if context menu should be displayed on right click.
 boolean isUseNativeRenderer()
          Gets the flag indicating if the AggregateTable should use native renderer to paint its aggregated cells.
 boolean needAdjustCellValueString(int rowIndex, int columnIndex)
          Only adjust the cell value string on aggregated columns.
 void prepareBeforeGroup()
           
 void setAggregatedColumns(int[] columns)
          Sets the aggregated columns.
 void setAggregatedColumns(String[] columnNames)
          Sets the aggregated columns.
 void setAutoAdjustGrouping(boolean autoAdjustGrouping)
          Sets the flag that controls the grouping behavior when dragging columns.
 void setAutoGrouping(boolean autoGrouping)
          Sets the flag if we should group the column if dragging the column to the very beginning of the table when there is no grouping.
 void setCellPopupMenuCustomizer(AggregateTable.PopupMenuCustomizer popupMenuCustomizer)
          Sets the popup menu customizer to customize the menu when user right click on the cells on aggregated column.
 void setColumnVisible(String fieldName, boolean visible)
          Sets the visibility of the column.
 void setModel(TableModel model)
           
 void setShowContextMenu(boolean showContextMenu)
          Sets the flag indicating if context menu should be displayed on right click.
 void setUseNativeRenderer(boolean useNativeRenderer)
          Sets the flag indicating if the AggregateTable should use native renderer to paint its aggregated cells.
 void setVersion(String version)
          Sets version string.
 void tableChanged(TableModelEvent e)
          Invoked when this table's TableModel generates a TableModelEvent.
protected  void updateAggregateColumns(TableColumn draggingColumn, int originalColumnIndex)
           
 void updateUI()
           
 
Methods inherited from class com.jidesoft.grid.SortableTable
createDefaultTableHeader, createSortableTableHeaderMouseListener, createSortIcon, getActualRowAt, getSortableHeaderMouseListener, getSortableTableModel, getSortArrowForeground, getSortedRowAt, getSortOrderForeground, isAutoResort, isEnsureSelectedRowVisibleOnTogglingSort, isMultiColumnSortable, isOptimized, isPreserveSelectionsAfterSorting, isReusable, isShowSortOrderNumber, isSortable, isSortingEnabled, resort, setAutoResort, setEnsureSelectedRowVisibleOnTogglingSort, setMultiColumnSortable, setOptimized, setPreserveSelectionsAfterSorting, setShowSortOrderNumber, setSortable, setSortArrowForeground, setSortingEnabled, setSortOrderForeground, sortChanged, sortChanging, sortColumn, sortColumn, sortColumn, sortColumn, sortColumn, sortColumn, unsort
 
Methods inherited from class com.jidesoft.grid.CategorizedTable
getAscendingIcon, getCategoryCollapsedIcon, getCategoryExpandedIcon, getCollapsedIcon, getCollapsedIcon, getDescendingIcon, getDisabledBackground, getDisabledForeground, getExpandedIcon, getExpandedIcon, getMarginBackground, isExpandIconVisible, isPaintMarginBackground, isUseLnfDefaultSortIcon, isUseTableRendererForCategoryRow, setAscendingIcon, setCategoryCollapsedIcon, setCategoryExpandedIcon, setCollapsedIcon, setDescendingIcon, setDisabledBackground, setDisabledForeground, setExpandedIcon, setExpandIconVisible, setMarginBackground, setPaintMarginBackground, setUseLnfDefaultSortIcon, setUseTableRendererForCategoryRow
 
Methods inherited from class com.jidesoft.grid.CellSpanTable
binarySearch, calculateRowHeight, calculateRowHeight, calculateRowHeights, columnAdded, columnAtPoint, columnMoved, columnRemoved, convertModelCellSpanToView, convertViewCellSpanToModel, createCellSpanCache, createDelegateAction, getActualRowHeight, getActualUIClassID, getAutoCellMerge, getCache, getCacheEmpty, getCellEditor, getCellRect, getCellSpanAt, getCellSpanAt, getCellSpanFromAutoCellMerge, getCellSpanFromSpanModel, getDirtyRegion, getScrollableUnitIncrement, getSpanModel, getValueAt, invalidateCellSpanCache, isAutoConvertCellSpan, isCellFocused, isCellSelected, isCellSpanCacheEnabled, isCellSpanOn, isKeepColumnAtPoint, isKeepRowAtPoint, isPaintCellSpanAsSelected, muteDefaultKeyStroke, originalColumnAtPoint, originalGetCellRect, originalRowAtPoint, prepareEditor, replaceAction, replaceAction, restoreAction, restoreAction, rolloverCellAt, rowAtPoint, setAutoCellMerge, setAutoConvertCellSpan, setCellSpanCacheEnabled, setKeepColumnAtPoint, setKeepRowAtPoint, setPaintCellSpanAsSelected, shouldCellBePaintedAsFocused, shouldCellBePaintedAsSelected, valueChanged, verifyCellSpan, verifyCellSpan
 
Methods inherited from class com.jidesoft.grid.CellStyleTable
addCellStyleCustomizer, clearCellStyleCustomizers, collectCellStyles, configureEditorComponent, configureRendererComponent, customizeEditorComponent, customizeRendererComponent, getCellStyleAt, getCellStyleCustomizers, getCellStyleProvider, getCellStyles, getFocusCellStyle, getNextStyleModel, getStyleModel, getTableStyleProvider, isFillsSelection, isFillsViewportWithStripe, mergeCellStyle, mergeCellStyles, needPaintStripedBackground, paintCellOverlay, paintCellUnderlay, paintComponent, prepareRenderer, releaseRendererComponent, removeCellStyleCustomizer, setCellStyleProvider, setFillsSelection, setFillsViewportWithStripe, setFocusCellStyle, setTableStyleProvider
 
Methods inherited from class com.jidesoft.grid.NavigableTable
changeSelection, findNearestNavigableCellInColumn, findNearestNavigableCellInRow, findNextNavigableCell, findNextNavigableCellInColumn, findNextNavigableCellInRow, findNextNavigableCellVertically, findPreviousNavigableCell, findPreviousNavigableCellInColumn, findPreviousNavigableCellInRow, findPreviousNavigableCellVertically, getNavigableModel, getNextNavigableModel, isCellNavigable, isNavigationKey, processKeyBinding
 
Methods inherited from class com.jidesoft.grid.ContextSensitiveTable
convertElementToString, createDefaultTransferHandler, getCellClassAt, getCellEditorFromManager, getCellRendererFromManager, getConverterContextAt, getDefaultCellRenderer, getEditorContextAt, invalidateCellRendererCache, isCellEditorManagerEnabled, isCellRendererManagerEnabled, setCellEditorManagerEnabled, setCellRendererManagerEnabled, setDefaultCellRenderer
 
Methods inherited from class com.jidesoft.grid.JideTable
addCellEditorListener, addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, addRowValidator, addUndo, addUndoableEditListener, addValidator, adjustSelectionWhenColumnMoved, alwaysCalculateCellRect, calculateAutoResizedRowHeights, calculateAutoResizedRowHeights, clearSelection, clearSelectionPermanently, columnSelectionChanged, configureEnclosingScrollPaneExplicitly, convertRowIndexToModel, convertRowIndexToView, createCellAutoCompletion, createDefaultColumnsFromModel, createDefaultSelectionModel, createDefaultTableSelectionModel, createRowAutoScrollingListener, createRowHeights, createSortHeaderRenderer, editingCanceled, editingStopped, fireEditingCanceled, fireEditingStarted, fireEditingStarting, fireEditingStopped, fireEditingStopping, getCellEditorListeners, getClickCountToStart, getDefaultRenderer, getEditorAutoCompletionMode, getEditorAutoCompletionMode, getEditorCellRect, getGridColor, getGridColorProvider, getRolloverCellEditor, getRolloverColumn, getRolloverRow, getRowHeight, getRowHeights, getRowValidator, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getTableColumnWidthKeeper, getTableSelectionModel, getTextComponentForEditorComponent, getToolTipText, getUndoManager, getValidator, getVerticalGridColor, indexChanged, initTable, isAdjustEditorLocationOnModelChanged, isAlwaysRequestFocusForEditor, isAutoResizeFillMode, isAutoSelectTextWhenStartsEditing, isAutoStartCellEditing, isAutoStartCellEditingKey, isBatchProcessing, isCalculateRowHeightsOnWidthChange, isCellContentVisible, isClearPropertyAtStructureChange, isClearSelectionOnTableDataChanges, isColumnAutoResizable, isColumnResizable, isColumnSelected, isEnableIgnored, isFillBottom, isFillGrids, isFillRight, isFillsBottom, isFillsGrids, isFillsGridsBottom, isFillsGridsRight, isFillsRight, isKeepRowHeights, isLoadSelectionOnTableDataChanged, isNestedTableHeader, isNonContiguousCellSelection, isRollover, isRowAutoResizes, isRowHeightChanged, isRowResizable, isRowSelected, isScrollRowWhenRowHeightChanges, isSelectInsertedRows, isTablePrinting, isValidCellEditingKey, isVariousRowHeights, loadTableRowSettings, paintFillHeader, removeCellEditorListener, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRolloverEditor, removeRowSelectionInterval, removeRowValidator, removeUndoableEditListener, removeValidator, resetTransferHandler, saveTableRowSettings, scrollRowToVisible, selectAll, setAdjustEditorLocationOnModelChanged, setAlwaysRequestFocusForEditor, setAutoResizeMode, setAutoSelectTextWhenStartsEditing, setAutoStartCellEditing, setBatchProcessing, setCalculateRowHeightsOnWidthChange, setCellContentVisible, setClearPropertyAtStructureChange, setClearSelectionOnTableDataChanges, setClickCountToStart, setColumnAutoResizable, setColumnResizable, setColumnSelectionAllowed, setColumnSelectionInterval, setEditorAutoCompletionMode, setEnabled, setEnableIgnored, setFillBottom, setFillGrids, setFillRight, setFillsBottom, setFillsGrids, setFillsRight, setGridColorProvider, setKeepRowHeights, setLoadSelectionOnTableDataChanged, setNestedTableHeader, setNonContiguousCellSelection, setPreferredSize, setRowAutoResizes, setRowHeight, setRowHeight, setRowHeights, setRowResizable, setRowSelectionAllowed, setRowSelectionInterval, setScrollRowWhenRowHeightChanges, setSelectInsertedRows, setSortTableHeaderRenderer, setTableColumnWidthKeeper, setTableHeader, setTablePrinting, setTableSelectionModel, setVariousRowHeights, startCellEditing, validate, validateRow
 
Methods inherited from class javax.swing.JTable
columnMarginChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createScrollPaneForTable, doLayout, editCellAt, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, getUpdateSelectionOnSort, initializeLocalVars, isCellEditable, isEditing, moveColumn, paramString, print, print, print, print, print, resizeAndRepaint, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setCellEditor, setCellSelectionEnabled, setColumnModel, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowMargin, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, unconfigureEnclosingScrollPane
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
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, setDropTarget, 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
 
Methods inherited from interface com.jidesoft.grid.TableAdapter
getCellSelectionEnabled, getColumnClass, getColumnCount, getColumnName, getColumnSelectionAllowed, getRowCount, getRowSelectionAllowed, isCellEditable, setCellSelectionEnabled, setValueAt
 

Field Detail

PROPERTY_DOUBLE_CLICK_ENABLED

public static final String PROPERTY_DOUBLE_CLICK_ENABLED
See Also:
Constant Field Values
Constructor Detail

AggregateTable

public AggregateTable()
Creates an empty AggregateTable.


AggregateTable

public AggregateTable(TableModel model)
Creates an AggregateTable. The model could be a regular TableModel. If so, after you create the table, you need to call aggregate() method to aggregate certain columns. You can also pass in an aggregated AggregateTableModel. If so, you of course don't need to call aggregate() method.

Parameters:
model - the table model.
Method Detail

createSortableTableModel

protected ISortableTableModel createSortableTableModel(TableModel model)
Description copied from class: SortableTable
Creates a SortableTableModel that wraps around the actual model. Subclass can override it to create your own SortableTableModel. For example TreeTable overrides it to create a SortableTreeTableModel for TreeTableModel.

Overrides:
createSortableTableModel in class SortableTable
Parameters:
model - the actual table model.
Returns:
a SortableTableModel.

setModel

public void setModel(TableModel model)
Overrides:
setModel in class SortableTable

tableChanged

public void tableChanged(TableModelEvent e)
Description copied from class: JideTable
Invoked when this table's TableModel generates a TableModelEvent. The TableModelEvent should be constructed in the coordinate system of the model; the appropriate mapping to the view coordinate system is performed by this JTable when it receives the event.

Application code will not use these methods explicitly, they are used internally by JTable.

Specified by:
tableChanged in interface TableModelListener
Overrides:
tableChanged in class CellSpanTable

getAggregateTableModel

public AggregateTableModel getAggregateTableModel()
Gets the AggregateTableModel for this table.

Returns:
the AggregateTableModel.

updateUI

public void updateUI()
Overrides:
updateUI in class CategorizedTable

getTableHeaderToolTipText

public String getTableHeaderToolTipText(int modelIndex)
Gets the TableHeader's tooltip for a particular model column index

Overrides:
getTableHeaderToolTipText in class JideTable
Parameters:
modelIndex - the model column index.
Returns:
the tooltip for the model column index where the mouse is over.

createCellRenderer

protected TableCellRenderer createCellRenderer()
Creates the special cell renderer for the first column which paints +/- icon and tree line.

Returns:
an instance of TreeTableCellRenderer. The same instance will be used to paint the cell of all rows in TreeTable.

createExpandMouseListener

protected MouseListener createExpandMouseListener()
Creates the mouse listener used to handle mouse click on +/- icon.

Please override this method if you are NOT in JDK 1.6. Otherwise, please use createExpandMouseInputListener(javax.swing.event.MouseInputListener) instead.

Returns:
a mouse listener.
See Also:
createExpandMouseInputListener(javax.swing.event.MouseInputListener)

isShowContextMenu

public boolean isShowContextMenu()
Gets the flag indicating if context menu should be displayed on right click.

Returns:
true if the context menu should be displayed. Otherwise false.
Since:
3.2.1
See Also:
setShowContextMenu(boolean)

setShowContextMenu

public void setShowContextMenu(boolean showContextMenu)
Sets the flag indicating if context menu should be displayed on right click.

By default, the flag is true. However, if you want to add an additional mouse listener to do something else, you might have to set this flag to false to make your listener get mouse event correctly.

Parameters:
showContextMenu - the flag
Since:
3.2.1

isUseNativeRenderer

public boolean isUseNativeRenderer()
Gets the flag indicating if the AggregateTable should use native renderer to paint its aggregated cells.

Returns:
true if native renderer should be used. Otherwise false.
Since:
3.5.12

setUseNativeRenderer

public void setUseNativeRenderer(boolean useNativeRenderer)
Sets the flag indicating if the AggregateTable should use native renderer to paint its aggregated cells.

Parameters:
useNativeRenderer - the flag
Since:
3.5.12

createExpandMouseInputListener

protected MouseInputListener createExpandMouseInputListener(MouseInputListener listener)
Creates the mouse listener used to handle mouse click on +/- icon.

Please override this method if you are in JDK 1.6. In other JDK releases, please use createExpandMouseListener() instead.

Parameters:
listener - old listener
Returns:
a mouse listener.
See Also:
createExpandMouseListener()

handleMouseEvent

protected void handleMouseEvent(MouseEvent e)
Handles the mouse event. It does two things. If single mouse clicks on the +/- icon will expand/collapse the row.

Parameters:
e - the mouse event.

getCellPopupMenuCustomizer

public AggregateTable.PopupMenuCustomizer getCellPopupMenuCustomizer()
Gets the popup menu customizer to customize the menu when user right click on the cells on aggregated column.

Returns:
the popup menu customizer.

setCellPopupMenuCustomizer

public void setCellPopupMenuCustomizer(AggregateTable.PopupMenuCustomizer popupMenuCustomizer)
Sets the popup menu customizer to customize the menu when user right click on the cells on aggregated column.

Parameters:
popupMenuCustomizer - a new PopupMenuCustomizer.

expand

public void expand(int rowIndex,
                   int columnIndex)
Expands the cell.

Parameters:
rowIndex - the row index of the cell
columnIndex - the column index of the cell
Since:
3.3.0

collapse

public void collapse(int rowIndex,
                     int columnIndex)
Collapses the cell.

Parameters:
rowIndex - the row index of the cell
columnIndex - the column index of the cell
Since:
3.3.0

expandAll

public void expandAll()
Expands all the cells.


collapseAll

public void collapseAll()
Collapses all the cells.


createDraggingColumnPropertyChangeListener

protected AggregateTable.DraggingHandler createDraggingColumnPropertyChangeListener()
Creates the TableColumnModelListener used to handle column rearrangement.

Returns:
a TableColumnModelListener.

updateAggregateColumns

protected void updateAggregateColumns(TableColumn draggingColumn,
                                      int originalColumnIndex)

getCellRenderer

public TableCellRenderer getCellRenderer(int rowIndex,
                                         int columnIndex)
Description copied from class: ContextSensitiveTable
Returns an appropriate renderer for the cell specified by this row and column. First, it will check if defaultCellRenderer is set using ContextSensitiveTable.getDefaultCellRenderer() method. If null, it will check is ContextSensitiveTable.isCellRendererManagerEnabled() is true. If true, it will look for the cell renderer that assigned to the specific column. Only if the renderer is still null, it will use the EditorContext information from ContextSensitiveTableModel and get the correct CellRedenerer from the CellRendererManager. In any case, if we can't determine a cell renderer, we will call super.getCellRenderer(row, column) just like regular JTable.

Overrides:
getCellRenderer in class CellSpanTable
Parameters:
rowIndex - the row of the cell to render, where 0 is the first row
columnIndex - the column of the cell to render, where 0 is the first column
Returns:
the renderer for the column and row.

getExpandableAt

public Expandable getExpandableAt(int rowIndex,
                                  int columnIndex)
Specified by:
getExpandableAt in interface ExpandableProvider

getHeaderTableModel

public HeaderTableModel getHeaderTableModel()
This is an interface for HeaderTableCellRenderer so that it can find the correct HeaderTableModel.

Returns:
the HeaderTableModel.

setAggregatedColumns

public void setAggregatedColumns(String[] columnNames)
Sets the aggregated columns. Nothing is changed at this point until aggregate() is called.

Parameters:
columnNames - the name of the columns to be aggregated.

setAggregatedColumns

public void setAggregatedColumns(int[] columns)
Sets the aggregated columns. Nothing is changed at this point until aggregate() is called.

Parameters:
columns - the index of the columns to be aggregated.

aggregate

public void aggregate(String[] columnNames)
Aggregates the specified columns.

Parameters:
columnNames - the name of the columns that will be aggregated.

aggregate

public void aggregate(int[] columns)
Aggregates the specified columns.

Parameters:
columns - the index of the columns to be aggregated.

aggregate

public void aggregate()
Aggregates the table model. You should call setAggregatedColumns(String[]) or setAggregatedColumns(int[]) before calling this method. Or you can combine the two calls into aggregate(String[]) or aggregate(int[]).


editCellAt

public boolean editCellAt(int row,
                          int column,
                          EventObject o)
Overrides so that clicking in the +/- icon area will not start editing the cell.

Overrides:
editCellAt in class CellSpanTable
Parameters:
row - the row to be edited
column - the column to be edited
o - the event that starts the cell editing
Returns:
false if for any reason the cell cannot be edited, or if the indices are invalid

isAutoAdjustGrouping

public boolean isAutoAdjustGrouping()
Gets the grouping behavior when dragging columns.

Returns:
the flag that if the dragging column will make the column grouped/ungrouped.
See Also:
setAutoAdjustGrouping(boolean)

setAutoAdjustGrouping

public void setAutoAdjustGrouping(boolean autoAdjustGrouping)
Sets the flag that controls the grouping behavior when dragging columns.

If the flag is true,

in the scenario that column A,B are grouping while column C,D,E are not grouped, move D before C will make D grouped.

in the scenario that column A,B are grouping while column C,D,E are not grouped, move A after B will make A ungrouping.

If the flag is false,

in the scenario that column A,B are grouping while column C,D,E are not grouped, move D before C will keep D not grouped.

in the scenario that column A,B are grouping while column C,D,E are not grouped, move A after B will keep A grouping.

Before 2.6.0 release, the behavior is the same as the flag is true. However, after 2.6.0 release, the default setting of this flag is false. So if you want to get exactly the same column dragging behavior as before release 2.6.0, please call the following code:

 setAutoAdjustGrouping(true);
 setAutoGrouping(true);
 

Parameters:
autoAdjustGrouping - the flag that if the dragging column will change its group/ungroup behavior while dragged to boundary

isAutoGrouping

public boolean isAutoGrouping()
Gets the flag if we should group the column if dragging the column to the very beginning of the table when there is no grouping.

Returns:
the flag if we should group the column if dragging the column to the very beginning of the table when there is no grouping.
See Also:
setAutoGrouping(boolean)

setAutoGrouping

public void setAutoGrouping(boolean autoGrouping)
Sets the flag if we should group the column if dragging the column to the very beginning of the table when there is no grouping.

This flag will take effect only when isAutoAdjustGrouping() returns true. If that method returns false, this behavior looks like this flag is FALSE no matter what the value actually is.

If the flag is true,

in the scenario that column A,B,C,D,E are all not grouped, move E before A will make E grouped.

If the flag is false,

in the scenario that column A,B,C,D,E are all not grouped, move E before A will keep E ungrouping.

Before 2.6.0 release, the behavior is the same as the flag is true. However, after 2.6.0 release, the default setting of this flag is false. So if you want to get exactly the same column dragging behavior as before release 2.6.0, please call the following code:

 setAutoAdjustGrouping(true);
 setAutoGrouping(true);
 

Parameters:
autoGrouping - the flag if we should group the column if dragging the column to the very beginning of the table when there is no grouping.

getVersion

public String getVersion()
Gets an optional version string.

Returns:
version string.

setVersion

public void setVersion(String version)
Sets version string.

Parameters:
version - the version of the saved layout.

isExpandIconVisible

public boolean isExpandIconVisible(Node node)
Checks if the +/- icon should visible for the node.

Parameters:
node - the node.
Returns:
true or false.

getResourceString

public String getResourceString(String key)
Gets the resource string used in AggregateTable. Subclass can override it to provide their own strings.

Parameters:
key - the resource key
Returns:
the localized string.

getValueAtInString

public String getValueAtInString(int rowIndex,
                                 int columnIndex,
                                 ValueConverter converter)
Gets the string value with summary name or the total/grand total. For example, if the stringValue parameter is "Aug", this method will return "Aug Sum" if the cell is a subtotal row/column of "Sum". If the cell is a grand total row or column, this method will return "Grand Total" which is defined in pivot.properties.

Specified by:
getValueAtInString in interface ValueStringAdjustProvider
Parameters:
rowIndex - the row index of the cell
columnIndex - the column index of the cell
converter - the cell value converter if applicable. null if you are not invoking this method for exporting to excel purpose.
Returns:
the string including the summary, total or grand total.

needAdjustCellValueString

public boolean needAdjustCellValueString(int rowIndex,
                                         int columnIndex)
Only adjust the cell value string on aggregated columns.

Specified by:
needAdjustCellValueString in interface ValueStringAdjustProvider
Parameters:
rowIndex - the row index
columnIndex - the column index
Returns:
true if the column index is less than aggregated column count. Otherwise false.

setColumnVisible

public void setColumnVisible(String fieldName,
                             boolean visible)
Sets the visibility of the column.

Parameters:
fieldName - the pivot field name
visible - the visibility of this column

getTableHeaderToolTipText

public String getTableHeaderToolTipText(MouseEvent event)
Description copied from class: JideTable
Gets the TableHeader's tooltip at the location of mouse event.

Overrides:
getTableHeaderToolTipText in class JideTable
Parameters:
event - the mouse event.
Returns:
the tooltip for the column where the mouse is over.

prepareBeforeGroup

public void prepareBeforeGroup()
Specified by:
prepareBeforeGroup in interface GroupHeaderTableProvider

JIDE 3.5.15