JIDE 3.5.15

com.jidesoft.pivot
Class PivotTablePane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.jidesoft.pivot.PivotTablePane
All Implemented Interfaces:
IndexChangeListener, PivotConstants, PivotValueProviderListener, ResourceProvider, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible

public class PivotTablePane
extends JPanel
implements PivotConstants, ResourceProvider, IndexChangeListener, PropertyChangeListener, PivotValueProviderListener

PivotTablePane is the main component for JIDE Pivot Grid.

See Also:
Serialized Form

Nested Class Summary
protected static class PivotTablePane.JideScrollPaneEx
           
static interface PivotTablePane.PopupMenuCustomizer
           
static interface PivotTablePane.TablePopupMenuCustomizer
           
 
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
protected  JButton _addToButton
           
protected  JComboBox _addToComboBox
           
protected  PivotField _addToComboBoxField
           
protected  TableColumnAutoResizer[] _columnAutoResizer
           
protected  FieldArea _columnFieldsArea
           
protected  JTable _columnHeaderTable
           
protected  Container _contentPanel
           
protected  JTable _cornerTable
           
protected  FieldArea _dataFieldsArea
           
protected  JTable _dataTable
           
protected  Map<PivotField,FieldBox> _fieldBoxMap
           
protected  FieldArea _filterFieldsArea
           
protected  FieldArea _rowFieldsArea
           
protected  JTable _rowHeaderTable
           
protected  JScrollPane _scrollPane
           
protected  JPanel _separator
           
protected  UnassignedFieldsArea _unassignedFieldsArea
           
protected static String CLIENT_PROPERTY_COLUMN_MODEL_LISTENER
           
protected static String CLIENT_PROPERTY_COMPONENT_LISTENER
           
protected static String CLIENT_PROPERTY_PROPERTY_CHANGE_LISTENER
           
static int FIELD_GAP
           
static String FIELD_SETTING_DIALOG_CANCEL_BUTTON
           
static String FIELD_SETTING_DIALOG_HIDE_BUTTON
           
static String FIELD_SETTING_DIALOG_OK_BUTTON
           
static String PROPERTY_COLUMN_FIELD_AREA_VISIBLE
           
static String PROPERTY_COLUMN_FIELD_FILTERABLE
           
static String PROPERTY_DATA_FIELD_AREA_VISIBLE
           
static String PROPERTY_DATA_FIELD_FILTERABLE
           
static String PROPERTY_DATA_FIELDS_DUPLICATION_ENABLED
           
static String PROPERTY_FIELD_CHOOSER_AREA_VISIBLE
           
static String PROPERTY_FILTER_FIELD_AREA_VISIBLE
           
static String PROPERTY_FLAT_LAYOUT
           
static String PROPERTY_GRID_COLOR
           
static String PROPERTY_HEADER_SELECTION_MODEL
           
static String PROPERTY_HIDE_EXPAND_ICON_ON_SINGLE_ROW
           
static String PROPERTY_PLAIN_HEADER_TABLES
           
static String PROPERTY_ROW_FIELD_AREA_VISIBLE
           
static String PROPERTY_ROW_FIELD_FILTERABLE
           
static String PROPERTY_SCROLL_SELECTION_TO_VISIBLE
           
static String PROPERTY_SHOW_FILTER_BUTTONS_ON_MOUSE_OVER
           
 
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 com.jidesoft.pivot.PivotConstants
AREA_COLUMN, AREA_DATA, AREA_FILTER, AREA_NAMES, AREA_NOT_ASSIGNED, AREA_ROW, COMPARE_TO_NEXT, COMPARE_TO_PREVIOUS, HEADER_SELECTION_DATA_TABLE_ONLY, HEADER_SELECTION_HEADER_TABLE_ONLY, RANGE_IN_TOTAL, RUNNING_SUMMARY_DIFFERENCE, RUNNING_SUMMARY_PERCENTAGE_FROM, RUNNING_SUMMARY_PERCENTAGE_OF, RUNNING_SUMMARY_PERCENTAGE_TOTAL, RUNNING_SUMMARY_TOTAL, STATISTICS_CALCULATION_DEFAULT, STATISTICS_CALCULATION_RUNNING, STATISTICS_CALCULATION_RUNNING_IN_COLUMN, STATISTICS_CALCULATION_RUNNING_LEAF, SUBTOTAL_AUTOMATIC, SUBTOTAL_CUSTOM, SUBTOTAL_NONE, SUMMARY_COUNT, SUMMARY_CUSTOM, SUMMARY_MAX, SUMMARY_MEAN, SUMMARY_MIN, SUMMARY_NAMES, SUMMARY_NONE, SUMMARY_RESERVED_MAX, SUMMARY_STDDEV, SUMMARY_SUM, SUMMARY_VAR
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PivotTablePane()
          Create an empty PivotTablePane.
PivotTablePane(IPivotDataModel dataModel)
          Creates a PivotTablePane.
 
Method Summary
protected  void addFieldBox(FieldBox fieldBox, int areaType)
           
 void addHiddenRowField(PivotField field)
          Add hidden header field.
 void addHiddenValues(Values values)
          Shows or hides the values based on the selection in the row header or column header.
 void autoResizeAllColumns()
          Auto-resize all table's table column width so that all cell contents are visible.
 void autoResizeAllColumns(boolean visibleAreaOnly)
          Auto-resize all table's table column width so that all cell contents are visible.
 void bothHeadersUpdated()
          Calls this method to tell the pivot table that both row and column header need to be updated.
 void clearFilter(boolean isRowHeader, int fromRow, int toRow, int fromColumn, int toColumn)
          clear current filters in the selected fields
 void clearHiddenRowFields()
          Clear hidden header fields.
 void clearHiddenValues()
          Shows all the hidden values.
 void columnFieldsUpdated()
          Calls this method to tell the pivot table that the column fields are updated so pivot table pane needs to update so that user can see the changes in the UI.
 void columnHeaderUpdated()
          Calls this method to tell the pivot table that the column header needs to be updated.
protected  void configureEnclosingScrollPaneForDataTable(JTable table)
          Customizes the scroll pane for data table.
 String convertElementToString(Locale locale, Object value, Class<?> clazz, ConverterContext context)
          Converters the element to string and used in FieldBox.
protected  Container createContentPanel()
          Creates the content panel that holds the pivot table and all the field areas.
protected  CustomFilterEditorDialog createCustomFilterEditorDialog(Container container, String title, CustomFilterEditor filterEditor)
          Create the custom filter editor dialog.
protected  DataTable createDataTable()
          Creates the table which is used for the data table.
protected  FieldArea createFieldArea(int areaType)
          Creates FieldArea for different fields.
protected  FieldBox createFieldBox(PivotField field, boolean sortArrowVisible, boolean filterButtonVisible)
          Creates the FieldBox.
protected  FieldBoxInputListener createFieldBoxInputListener()
          Creates the FieldBoxInputListener.
protected  Container createFieldPanel()
          Creates the panel holds the field chooser.
protected  ButtonPanel createFieldSettingsDialogButtonPanel(StandardDialog dialog)
          Creates the button panel in field settings dialog.
protected  FieldSettingsPanel createFieldSettingsPanel()
          Creates the field settings panel.
protected  HeaderTable createHeaderTable()
          Creates the header table for row header and column header.
protected  JScrollPane createScrollPane()
          Creates the scroll pane used by PivotTablePane.
protected  void customizeFieldBox(FieldBox box)
          Customizes the FieldBox.
protected  void customizeFieldsPanel(Container panel)
           
protected  void customizeScrollPane(JScrollPane scrollPane)
          Customizes the scroll pane.
 void dataTableUpdated()
          Calls this method to tell the pivot table that the data table needs to be repainted.
 void fieldsUpdated()
          Calls this method to tell the pivot table that the fields are updated so pivot table pane needs to update so that user can see the changes in the UI.
protected  void fillUnassignedFieldArea(UnassignedFieldsArea fieldsArea, List<FieldBox> boxes, QuickFilterField filterField)
          Fills the field boxes for the unassigned fields to the UnassignedFieldsArea.
 void filterSelectedHeaderValues(boolean isRowHeader, boolean isFilterNotShow, int fromRow, int toRow, int fromColumn, int toColumn)
          filter the selected header values or show only the selected header values
protected  int getAdjustedRowHeights()
          Gets the number of row height each row will occupy.
static String getAreaName(Locale locale, int areaType)
           
 JTable getColumnHeaderTable()
          Gets the column header table.
 JTable getCornerTable()
          Gets the corner table.
 JTable getDataTable()
          Gets the data table.
 PivotTablePane.PopupMenuCustomizer getDataTablePopupMenuCustomizer()
          Gets the popup menu customizer to customize the menu when user right click on the data table.
 Cursor getDragNoDropCursor()
          Get the cursor to be displayed when the field is prohibited to be dropped into current area.
 Cursor getDragRemoveCursor()
          Get the cursor to be displayed when the field is going to be removed from current area.
protected  String getDuplicatedTitle(PivotField field)
           
 String getFieldAreaMessage(int areaType)
           
 String getFieldAreaName(int areaType)
           
 int getFieldAreaType(String name)
           
 Container getFieldChooser()
          Gets the unassigned field chooser.
 JPanel getFieldChooserComboBoxPanel()
          Gets the panel for the add to combobox on FieldChooser.
 Icon getFilterIcon()
          Gets the filter icon.
 Color getGridColor()
          Gets the grid color that is used to paint the grid of the header tables and the data table.
 int getHeaderSelectionMode()
          Get the flag indicating the selection mode while clicking on the header table.
 PivotTablePane.PopupMenuCustomizer getHeaderTablePopupMenuCustomizer()
          Gets the popup menu customizer to customize the menu when user right click on the row or column header tables.
 PivotField[] getHiddenRowFields()
          Get all hidden row fields.
 IPivotDataModel getPivotDataModel()
          Gets the PivotDataModel.
 PivotTablePane.PopupMenuCustomizer getPopupMenuCustomizer()
          Gets the popup menu customizer to customize the menu when user right click on the fields.
 String getResourceString(String key)
          Gets the resource string used in PivotTablePane.
 int[] getRowFieldsWidth()
          Gets the row field boxes' width as an int array.
 JTable getRowHeaderTable()
          Gets the row header table.
 int getRowHeight()
           
 JScrollPane getScrollPane()
          Gets the scroll pane used by PivotTablePane.
static int getSummaryCount()
           
static String getSummaryName(Locale locale, int summaryType)
           
static Map<Integer,Integer>[] getTableColumnWidth(HeaderTable table)
           
 String getVersion()
          Gets an optional version string.
 int getVisibleRowCount()
          Returns the preferred number of visible rows.
 void hideColumns(int[] columnIndices)
          Hide the columns in DataTable.
protected  void hideFieldBox(FieldBox fieldBox)
          Hides the field box.
 void hideValuesAt(boolean isRowHeader, int rowIndex, int columnIndex)
          Hides the column or the row based on the row index and column index in the row header or column header.
 void indexChanged(IndexChangeEvent event)
          Called whenever the model wrapper is going to have index changed.
protected  void initComponents()
          Creates the child components.
 boolean isColumnAutoResizable()
          Checks if the columns are auto-resizable.
 boolean isColumnFieldAreaVisible()
           
 boolean isColumnFieldFilterable()
          Checks if the column field filterable.
 boolean isColumnHidden(int columnIndex)
          Check if the column in DataTable is hidden.
 boolean isConsiderRowFieldWidth()
          Get the flag if it should consider row field width while auto resizing the row header table columns.
 boolean isDataFieldAreaVisible()
           
 boolean isDataFieldFilterable()
          Checks if the data field filterable.
 boolean isDataFieldsDuplicationEnabled()
          Gets the flag indicating if the data fields could be duplicated.
 boolean isFieldChooserEnabled()
          Checks if the field chooser panel is enabled.
 boolean isFieldChooserFilterFieldVisible()
          Checks if the the quick filter field which is used to filter the field chooser is visible.
 boolean isFieldChooserVisible()
          Checks if filter chooser area is visible.
 boolean isFilterFieldAreaVisible()
           
 boolean isFiltering(boolean isRowHeader, int fromRow, int toRow, int fromColumn, int toColumn)
          check if the selected field have some rows/columns filtered already
 boolean isFlatLayout()
          Gets the flag indicating if the flat layout is in use.
 boolean isHideExpandIconOnSingleRow()
          Get the flag indicating if the expand icon should be hidden if the row only contains one child.
 boolean isHideFieldOnDraggingOut()
          Checks if the field box will be hidden when user drags it and drop outside the field areas.
 boolean isPlainHeaderTables()
          Get the flag indicating the header table painting mode.
 boolean isRearrangable()
           
 boolean isRespectFieldPreferredWidth()
          Get the flag indicating if the column width will respect the preferred width defined in PivotField.
 boolean isRowFieldAreaVisible()
           
 boolean isRowFieldFilterable()
          Checks if the row field filterable.
 boolean isScrollSelectionToVisible()
          Get the flag indicating if PivotTablePane should scroll the selection to visible while loading selections.
 boolean isSelectedHeaderFilterable(boolean isRowHeader, int fromRow, int toRow, int fromColumn, int toColumn)
           
 boolean isShowFilterButtonsOnMouseOver()
          Gets the flag indicating if the filter buttons in FieldBox should be displayed always or only when the mouse is over the button.
 boolean isShowFilterIcon()
          Checks if the filter icon should be visible on the FieldBox when there is filter for a field.
 boolean isShrinkDataFieldArea()
          If true, it will shrink the data field area so that it doesn't go wider than the row header table.
 void loadSelection(Object[] selectedKeyValues)
          Restore the selection in the DataTable part of the PivotTablePane.
 void loadSelection(Object[] selectedKeyValues, boolean scrollSelectionToVisible)
          Restore the selection in the DataTable part of the PivotTablePane.
 void loadSelection(Object[] selectedKeyValues, boolean scrollSelectionToVisible, boolean selectParentNode)
          Restore the selection in the DataTable part of the PivotTablePane.
protected  void moveFieldBox(FieldBox fieldBox, boolean before)
          Moves the field box
protected  void moveFieldBox(FieldBox fieldBox, FieldBox destFieldBox, boolean before)
           
protected  void moveFieldBoxToBeginning(FieldBox fieldBox)
           
protected  void moveFieldBoxToEnd(FieldBox fieldBox)
           
 void paint(Graphics g)
           
 void pivotValueProviderEventHandler(PivotValueProviderEvent event)
           
 void propertyChange(PropertyChangeEvent evt)
           
 void removeHiddenRowField(PivotField field)
          Remove hidden header field.
 void removeHiddenValues(Values values)
          Shows or hides the values based on the selection in the row header or column header.
 void rowFieldsUpdated()
          Calls this method to tell the pivot table that the row fields are updated so pivot table pane needs to update so that user can see the changes in the UI.
 void rowHeaderUpdated()
          Calls this method to tell the pivot table that the row header needs to be updated.
 Object[] saveSelection()
          Save the selection of the DataTable part of the PivotTablePane as an array of Values.
 void selectDataCells(boolean isRowHeader, int rowIndex, int columnIndex)
          Selects the data cells based on the selection in the row header or column header.
protected  void selectDataCells(boolean isRowHeader, int rowIndex, int columnIndex, boolean toggle)
          Selects the data cells based on the selection in the row header or column header.
 void selectDataCellsBetween(boolean isRowHeader, int startRowIndex, int startColumnIndex, int endRowIndex, int endColumnIndex)
          Selects the data cells based on the selection in multiple row headers or column headers.
protected  void selectDataCellsBetween(boolean isRowHeader, int startRowIndex, int startColumnIndex, int endRowIndex, int endColumnIndex, boolean toggle)
          Selects the data cells based on the selection in multiple row headers or column headers.
 void selectFieldBox(FieldBox box)
           
 void setColumnAutoResizable(boolean resizable)
          Enable or disable the column auto-resizable.
 void setColumnFieldAreaVisible(boolean columnFieldAreaVisible)
           
 void setColumnFieldFilterable(boolean columnFieldFilterable)
          Sets the column field filterable flag.
 void setConsiderRowFieldWidth(boolean considerRowFieldWidth)
          Set the flag if it should consider row field width while auto resizing the row header table columns.
protected  void setCornerTableModel(JTable table, TableModel tableModel)
           
 void setCursor(Cursor cursor)
           
 void setDataFieldAreaVisible(boolean dataFieldAreaVisible)
           
 void setDataFieldFilterable(boolean dataFieldFilterable)
          Sets the data field filterable flag.
 void setDataFieldsDuplicationEnabled(boolean dataFieldsDuplicationEnabled)
          Sets the flag indicating if the data fields could be duplicated.
protected  void setDataTableModel(JTable table, TableModel tableModel)
          Sets the data table model to the data table.
 void setDataTablePopupMenuCustomizer(PivotTablePane.PopupMenuCustomizer popupMenuCustomizer)
          Sets the popup menu customizer to customize the menu when user right click on the data table.
 void setDragNoDropCursor(Cursor dragNoDropCursor)
          Set the cursor to be displayed when the field is prohibited to be dropped into current area.
 void setDragRemoveCursor(Cursor dragRemoveCursor)
          Set the cursor to be displayed when the field is going to be removed from current area.
 void setFieldChooserEnabled(boolean fieldChooserEnabled)
          Sets whether the field chooser panel is enabled.
 void setFieldChooserFilterFieldVisible(boolean visible)
          Shows or hides the quick filter field which is used to filter the field chooser.
 void setFieldChooserVisible(boolean fieldChooserAreaVisible)
          Shows or hide the field chooser area.
 void setFilterFieldAreaVisible(boolean filterFieldAreaVisible)
           
 void setFilterIcon(Icon filterIcon)
          Sets the filter icon.
 void setFlatLayout(boolean flatLayout)
          Sets the flag indicating if the flat layout is in use.
 void setGridColor(Color gridColor)
          Sets the grid color that is used to paint the grid of the header tables and the data table.
 void setHeaderSelectionMode(int headerSelectionMode)
          Set the flag indicating the selection mode while clicking on the header table.
protected  void setHeaderTableModel(JTable table, TableModel tableModel)
          Sets the header table model to header table.
 void setHeaderTablePopupMenuCustomizer(PivotTablePane.PopupMenuCustomizer popupMenuCustomizer)
          Sets the popup menu customizer to customize the menu when user right click on the row or column header tables.
 void setHideExpandIconOnSingleRow(boolean hideExpandIconOnSingleRow)
          Set the flag indicating if the expand icon should be hidden if the row only contains one child.
 void setHideFieldOnDraggingOut(boolean hideFieldOnDraggingOut)
          Sets the flag if dragging a field box outside the field area will hide the field.
protected  void setKeepFieldAreaFit(boolean keepFieldAreaFit)
          This is an internally used flag.
 void setLocale(Locale l)
           
 void setPivotDataModel(IPivotDataModel dataModel)
          Set the PivotDataModel.
 void setPlainHeaderTables(boolean plainHeaderTables)
          Set the flag indicating the header table painting mode.
 void setPopupMenuCustomizer(PivotTablePane.PopupMenuCustomizer popupMenuCustomizer)
          Sets the popup menu customizer to customize the menu when user right click on the fields.
 void setRearrangable(boolean rearrangable)
          Sets the rearrangable flag.
 void setRespectFieldPreferredWidth(boolean respectFieldPreferredWidth)
          Set the flag indicating if the column width will respect the preferred width defined in PivotField.
 void setRowFieldAreaVisible(boolean rowFieldAreaVisible)
           
 void setRowFieldFilterable(boolean rowFieldFilterable)
          Sets the row field filterable flag.
 void setRowHeight(int rowHeight)
           
 void setScrollSelectionToVisible(boolean scrollSelectionToVisible)
          Set the flag indicating if PivotTablePane should scroll the selection to visible while loading selections.
 void setShowFilterButtonsOnMouseOver(boolean showFilterButtonsOnMouseOver)
          Sets the flag indicating if the filter buttons in FieldBox should be displayed always or only when the mouse is over the button.
 void setShowFilterIcon(boolean showFilterIcon)
          Sets the flag to show the filter icon.
 void setShrinkDataFieldArea(boolean shrinkDataFieldArea)
          If true, it will shrink the data field area so that it doesn't go wider than the row header table.
static void setTableColumnWidth(HeaderTable table, Map<Integer,Integer>[] widths)
           
protected  void setupLayout(Container contentPanel, Container fieldsPanel)
          Setup the layout of the field areas and the child tables.
 void setVersion(String version)
          Sets version string.
 void setVisibleRowCount(int visibleRowCount)
          Sets the preferred number of rows in the lists.
 void showColumns(int[] columnIndices)
          Show the columns in DataTable.
protected  void showFieldSettingsDialog(FieldBox fieldBox)
          Shows the field setting dialog.
protected  void showPopup(Point p)
           
 void stopCellEditing()
          Stops the cell editing in case the tables in PivotTablePane is in editing mode.
 void synchronizeFieldAreaTableWidth(JTable table, FieldArea fieldArea, FieldArea secondaryFieldArea)
           
 void synchronizeFieldAreaWithColumnWidth(JTable table, FieldArea fieldArea)
           
 void synchronizeFieldAreaWithField(FieldBox box)
           
protected  void uncustomizeFieldBox(FieldBox box)
           
 void updatePossibleValues()
           
 void updatePossibleValues(FieldBox box)
           
 void updateUI()
           
protected  boolean validateFieldBoxDragging(FieldBox draggingFieldBox, Component targetFieldBoxOrFieldArea, boolean before)
          A validation method before a field box is dropped to a target .
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, setVisible, 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, 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, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, 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
 

Field Detail

_filterFieldsArea

protected FieldArea _filterFieldsArea

_dataFieldsArea

protected FieldArea _dataFieldsArea

_rowFieldsArea

protected FieldArea _rowFieldsArea

_columnFieldsArea

protected FieldArea _columnFieldsArea

_fieldBoxMap

protected Map<PivotField,FieldBox> _fieldBoxMap

_rowHeaderTable

protected JTable _rowHeaderTable

_columnHeaderTable

protected JTable _columnHeaderTable

_dataTable

protected JTable _dataTable

_cornerTable

protected JTable _cornerTable

FIELD_GAP

public static final int FIELD_GAP
See Also:
Constant Field Values

_unassignedFieldsArea

protected UnassignedFieldsArea _unassignedFieldsArea

PROPERTY_PLAIN_HEADER_TABLES

public static final String PROPERTY_PLAIN_HEADER_TABLES
See Also:
Constant Field Values

PROPERTY_HEADER_SELECTION_MODEL

public static final String PROPERTY_HEADER_SELECTION_MODEL
See Also:
Constant Field Values

PROPERTY_GRID_COLOR

public static final String PROPERTY_GRID_COLOR
See Also:
Constant Field Values

PROPERTY_FILTER_FIELD_AREA_VISIBLE

public static final String PROPERTY_FILTER_FIELD_AREA_VISIBLE
See Also:
Constant Field Values

PROPERTY_DATA_FIELD_AREA_VISIBLE

public static final String PROPERTY_DATA_FIELD_AREA_VISIBLE
See Also:
Constant Field Values

PROPERTY_ROW_FIELD_AREA_VISIBLE

public static final String PROPERTY_ROW_FIELD_AREA_VISIBLE
See Also:
Constant Field Values

PROPERTY_COLUMN_FIELD_AREA_VISIBLE

public static final String PROPERTY_COLUMN_FIELD_AREA_VISIBLE
See Also:
Constant Field Values

PROPERTY_FIELD_CHOOSER_AREA_VISIBLE

public static final String PROPERTY_FIELD_CHOOSER_AREA_VISIBLE
See Also:
Constant Field Values

PROPERTY_DATA_FIELD_FILTERABLE

public static final String PROPERTY_DATA_FIELD_FILTERABLE
See Also:
Constant Field Values

PROPERTY_COLUMN_FIELD_FILTERABLE

public static final String PROPERTY_COLUMN_FIELD_FILTERABLE
See Also:
Constant Field Values

PROPERTY_ROW_FIELD_FILTERABLE

public static final String PROPERTY_ROW_FIELD_FILTERABLE
See Also:
Constant Field Values

PROPERTY_HIDE_EXPAND_ICON_ON_SINGLE_ROW

public static final String PROPERTY_HIDE_EXPAND_ICON_ON_SINGLE_ROW
See Also:
Constant Field Values

PROPERTY_SCROLL_SELECTION_TO_VISIBLE

public static final String PROPERTY_SCROLL_SELECTION_TO_VISIBLE
See Also:
Constant Field Values

PROPERTY_FLAT_LAYOUT

public static final String PROPERTY_FLAT_LAYOUT
See Also:
Constant Field Values

PROPERTY_SHOW_FILTER_BUTTONS_ON_MOUSE_OVER

public static final String PROPERTY_SHOW_FILTER_BUTTONS_ON_MOUSE_OVER
See Also:
Constant Field Values

PROPERTY_DATA_FIELDS_DUPLICATION_ENABLED

public static final String PROPERTY_DATA_FIELDS_DUPLICATION_ENABLED
See Also:
Constant Field Values

_separator

protected JPanel _separator

_contentPanel

protected Container _contentPanel

_scrollPane

protected JScrollPane _scrollPane

_addToComboBox

protected JComboBox _addToComboBox

_addToButton

protected JButton _addToButton

_addToComboBoxField

protected PivotField _addToComboBoxField

_columnAutoResizer

protected TableColumnAutoResizer[] _columnAutoResizer

CLIENT_PROPERTY_COLUMN_MODEL_LISTENER

protected static final String CLIENT_PROPERTY_COLUMN_MODEL_LISTENER
See Also:
Constant Field Values

CLIENT_PROPERTY_PROPERTY_CHANGE_LISTENER

protected static final String CLIENT_PROPERTY_PROPERTY_CHANGE_LISTENER
See Also:
Constant Field Values

CLIENT_PROPERTY_COMPONENT_LISTENER

protected static final String CLIENT_PROPERTY_COMPONENT_LISTENER
See Also:
Constant Field Values

FIELD_SETTING_DIALOG_OK_BUTTON

public static final String FIELD_SETTING_DIALOG_OK_BUTTON
See Also:
Constant Field Values

FIELD_SETTING_DIALOG_CANCEL_BUTTON

public static final String FIELD_SETTING_DIALOG_CANCEL_BUTTON
See Also:
Constant Field Values

FIELD_SETTING_DIALOG_HIDE_BUTTON

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

PivotTablePane

public PivotTablePane()
Create an empty PivotTablePane.


PivotTablePane

public PivotTablePane(IPivotDataModel dataModel)
Creates a PivotTablePane.

Parameters:
dataModel - the pivot data model
Method Detail

setPivotDataModel

public void setPivotDataModel(IPivotDataModel dataModel)
Set the PivotDataModel. Usually you should pass in the data model through the constructor. But if you have to use the empty constructor, you can use this method to set the data model.

Parameters:
dataModel - the pivot data model.

updateUI

public void updateUI()
Overrides:
updateUI in class JPanel

createFieldPanel

protected Container createFieldPanel()
Creates the panel holds the field chooser.

Returns:
a panel holds the field chooser.

createContentPanel

protected Container createContentPanel()
Creates the content panel that holds the pivot table and all the field areas.

By default, the content panel will paint a light blue background in the filter/row/column field area. If you want to change the default behavior, please override this method to create a plain JPanel. If you want to change the color setting globally, Please use the following code.

          UIDefaultsLookup.put(UIManager.getDefaults(), "Theme.painter", new Office2007Painter() {
 

public void paintContentBackground(JComponent c, Graphics g, Rectangle rect, int orientation, int state) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setColor(Color.red); g2d.fillRect(rect.x, rect.y, rect.width, rect.height); g2d.dispose(); } });

Returns:
the content panel.

initComponents

protected void initComponents()
Creates the child components.


propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

createFieldBoxInputListener

protected FieldBoxInputListener createFieldBoxInputListener()
Creates the FieldBoxInputListener. This is the listener added to the FieldBox to implement drag-n-drop, handle clicks etc.

Returns:
FieldBoxInputListener.

validateFieldBoxDragging

protected boolean validateFieldBoxDragging(FieldBox draggingFieldBox,
                                           Component targetFieldBoxOrFieldArea,
                                           boolean before)
A validation method before a field box is dropped to a target . By default, it will return true. You could override this method to add some widgets or checking here.

Parameters:
draggingFieldBox - the FieldBox that is currently being dragged
targetFieldBoxOrFieldArea - the target field box or target field area. Could be null if the field box is dragged outside and will be moved to the unassigned field area.
before - if the second parameter is a FieldBox, this parameter indicates if the dragging field box will be moved before or after the target field box.
Returns:
true by default.
Since:
3.4.1

indexChanged

public void indexChanged(IndexChangeEvent event)
Description copied from interface: IndexChangeListener
Called whenever the model wrapper is going to have index changed. So far we have index changing and index changed events.

Specified by:
indexChanged in interface IndexChangeListener
Parameters:
event - the IndexChangeEvent

pivotValueProviderEventHandler

public void pivotValueProviderEventHandler(PivotValueProviderEvent event)
Specified by:
pivotValueProviderEventHandler in interface PivotValueProviderListener

createFieldArea

protected FieldArea createFieldArea(int areaType)
Creates FieldArea for different fields. Subclass can override it to create a subclass of the FieldArea or customize the default FieldArea.

Parameters:
areaType - the area type.
Returns:
FieldArea.

configureEnclosingScrollPaneForDataTable

protected void configureEnclosingScrollPaneForDataTable(JTable table)
Customizes the scroll pane for data table. You must override configureEnclosingScrollPane method of the data table and call this method.

Parameters:
table - the data table
See Also:
createDataTable()

createDataTable

protected DataTable createDataTable()
Creates the table which is used for the data table. Here is the default code.
 protected CellStyleTable createDataTable() {
     return new DataTable(this);
 }
 

Returns:
the data table.

createHeaderTable

protected HeaderTable createHeaderTable()
Creates the header table for row header and column header. By default, we simple return new HeaderTable(this).

Returns:
a header table.

getAdjustedRowHeights

protected int getAdjustedRowHeights()
Gets the number of row height each row will occupy.

Returns:
the number of the row height each row will occupy. it returns 1 by default meaning each row is at one full row height. Subclass can override to return more.

setupLayout

protected void setupLayout(Container contentPanel,
                           Container fieldsPanel)
Setup the layout of the field areas and the child tables.

Parameters:
contentPanel - the content panel where the whole pivot table is placed.
fieldsPanel - the unassigned fields panel

createScrollPane

protected JScrollPane createScrollPane()
Creates the scroll pane used by PivotTablePane. By default, we will create an instance of PivotTablePane.JideScrollPaneEx.

Returns:
a scroll pane.

customizeScrollPane

protected void customizeScrollPane(JScrollPane scrollPane)
Customizes the scroll pane. Subclass can override it to customize this scroll pane.

Parameters:
scrollPane - the scroll pane used by the pivot table.

customizeFieldsPanel

protected void customizeFieldsPanel(Container panel)

updatePossibleValues

public void updatePossibleValues()

updatePossibleValues

public void updatePossibleValues(FieldBox box)

getDuplicatedTitle

protected String getDuplicatedTitle(PivotField field)

fillUnassignedFieldArea

protected void fillUnassignedFieldArea(UnassignedFieldsArea fieldsArea,
                                       List<FieldBox> boxes,
                                       QuickFilterField filterField)
Fills the field boxes for the unassigned fields to the UnassignedFieldsArea. By default, we add all field boxes to UnassignedFieldsArea using a JideBoxLayout. If the filterField has filtering text and we will do the filter by not adding the field box to the UnassignedFieldsArea. See below for the actual code for your reference.
 fieldsArea.removeAll();
 fieldsArea.clearFieldBoxs();
 fieldsArea.setLayout(new JideBoxLayout(fieldsArea, JideBoxLayout.Y_AXIS));
 for (FieldBox box : boxes) {
     fieldsArea.addFieldBox(box);
     if (isFieldChooserFilterFieldVisible() && !filterField.matches(box.getField(),
 filterField.getSearchingText())) {
         continue;
     }
     fieldsArea.add(box);
 }
 fieldsArea.add(Box.createGlue(), JideBoxLayout.VARY);
 fieldsArea.revalidate();
 

Parameters:
fieldsArea - the unassigned field area. It is a JPanel.
boxes - the field boxes for unassigned fields.
filterField - the filter field for the unassigned field area.

createFieldBox

protected FieldBox createFieldBox(PivotField field,
                                  boolean sortArrowVisible,
                                  boolean filterButtonVisible)
Creates the FieldBox.

Parameters:
field - the pivot field
sortArrowVisible - whether sort arrow should be visible.
filterButtonVisible - whether the filter button should be visible.
Returns:
a Field Box.

customizeFieldBox

protected void customizeFieldBox(FieldBox box)
Customizes the FieldBox.

Parameters:
box - the field box to be customized.

uncustomizeFieldBox

protected void uncustomizeFieldBox(FieldBox box)

selectFieldBox

public void selectFieldBox(FieldBox box)

rowHeaderUpdated

public void rowHeaderUpdated()
Calls this method to tell the pivot table that the row header needs to be updated. For example, if you call PivotDataModel.setShowGrandTotalForRow(boolean), you should call this method to update the UI.

Please note, this method implies dataTableUpdated().


columnHeaderUpdated

public void columnHeaderUpdated()
Calls this method to tell the pivot table that the column header needs to be updated. For example, if you call PivotDataModel.setShowGrandTotalForColumn(boolean) , you should call this method to update the UI.

Please note, this method implies dataTableUpdated().


setDataTableModel

protected void setDataTableModel(JTable table,
                                 TableModel tableModel)
Sets the data table model to the data table. We exposed this method to allow user to add a wrapper table model (such as CacheTableModel) to the table model before setting it to the data table.

Parameters:
table - the data table
tableModel - the data table model

setHeaderTableModel

protected void setHeaderTableModel(JTable table,
                                   TableModel tableModel)
Sets the header table model to header table. We exposed this method to allow user to add a wrapper table model (such as CacheTableModel) to the table model before setting it to the header table.

Parameters:
table - the data table
tableModel - the data table model

setCornerTableModel

protected void setCornerTableModel(JTable table,
                                   TableModel tableModel)

getTableColumnWidth

public static Map<Integer,Integer>[] getTableColumnWidth(HeaderTable table)

setTableColumnWidth

public static void setTableColumnWidth(HeaderTable table,
                                       Map<Integer,Integer>[] widths)

bothHeadersUpdated

public void bothHeadersUpdated()
Calls this method to tell the pivot table that both row and column header need to be updated. For example, if you call PivotDataModel.setShowGrandTotalForColumn(boolean) and PivotDataModel.setShowGrandTotalForRow(boolean), you should call this method to update the UI.

Please note, this method implies dataTableUpdated().


dataTableUpdated

public void dataTableUpdated()
Calls this method to tell the pivot table that the data table needs to be repainted. This method equals to ((DataTableModel) getPivotDataModel().getDateTableModel()).fireTableDataChanged().


fieldsUpdated

public void fieldsUpdated()
Calls this method to tell the pivot table that the fields are updated so pivot table pane needs to update so that user can see the changes in the UI. The main reason we didn't automatically update the UI is because you might want to update many settings then just update UI once. For example, you can get several PivotFields from PivotDataModel, change summary type of subtotal types. After you are done changing, just call fieldsUpdated once.

Please note, this method is thread safe.


rowFieldsUpdated

public void rowFieldsUpdated()
Calls this method to tell the pivot table that the row fields are updated so pivot table pane needs to update so that user can see the changes in the UI.

Please note, this method is thread safe.


columnFieldsUpdated

public void columnFieldsUpdated()
Calls this method to tell the pivot table that the column fields are updated so pivot table pane needs to update so that user can see the changes in the UI.

Please note, this method is thread safe.


synchronizeFieldAreaWithColumnWidth

public void synchronizeFieldAreaWithColumnWidth(JTable table,
                                                FieldArea fieldArea)

synchronizeFieldAreaTableWidth

public void synchronizeFieldAreaTableWidth(JTable table,
                                           FieldArea fieldArea,
                                           FieldArea secondaryFieldArea)

synchronizeFieldAreaWithField

public void synchronizeFieldAreaWithField(FieldBox box)

getRowHeight

public int getRowHeight()

setRowHeight

public void setRowHeight(int rowHeight)

setVisibleRowCount

public void setVisibleRowCount(int visibleRowCount)
Sets the preferred number of rows in the lists.

Parameters:
visibleRowCount - the visible row count.

getVisibleRowCount

public int getVisibleRowCount()
Returns the preferred number of visible rows.

Returns:
an integer indicating the preferred number of rows to display without using a scroll bar

paint

public void paint(Graphics g)
Overrides:
paint in class JComponent

setCursor

public void setCursor(Cursor cursor)
Overrides:
setCursor in class Component

hideFieldBox

protected void hideFieldBox(FieldBox fieldBox)
Hides the field box.

Parameters:
fieldBox - the field box to be hidden.

moveFieldBox

protected void moveFieldBox(FieldBox fieldBox,
                            boolean before)
Moves the field box

Parameters:
fieldBox - the field box to be moved.
before - true to move it before its current position. False to move after its current position.

moveFieldBoxToBeginning

protected void moveFieldBoxToBeginning(FieldBox fieldBox)

moveFieldBoxToEnd

protected void moveFieldBoxToEnd(FieldBox fieldBox)

addFieldBox

protected void addFieldBox(FieldBox fieldBox,
                           int areaType)

moveFieldBox

protected void moveFieldBox(FieldBox fieldBox,
                            FieldBox destFieldBox,
                            boolean before)

setFieldChooserVisible

public void setFieldChooserVisible(boolean fieldChooserAreaVisible)
Shows or hide the field chooser area.

Parameters:
fieldChooserAreaVisible - true or false.

isFieldChooserVisible

public boolean isFieldChooserVisible()
Checks if filter chooser area is visible.

Returns:
true if filter chooser is visible. Otherwise false.

getRowHeaderTable

public JTable getRowHeaderTable()
Gets the row header table.

Returns:
the row header table.

getColumnHeaderTable

public JTable getColumnHeaderTable()
Gets the column header table.

Returns:
the column header table.

getDataTable

public JTable getDataTable()
Gets the data table.

Returns:
the data table.

getCornerTable

public JTable getCornerTable()
Gets the corner table.

Returns:
the corner table.

getPivotDataModel

public IPivotDataModel getPivotDataModel()
Gets the PivotDataModel.

Returns:
the PivotDataModel.

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.

showPopup

protected void showPopup(Point p)

showFieldSettingsDialog

protected void showFieldSettingsDialog(FieldBox fieldBox)
Shows the field setting dialog.

Parameters:
fieldBox - the field box for which the field settings dialog is for.

createCustomFilterEditorDialog

protected CustomFilterEditorDialog createCustomFilterEditorDialog(Container container,
                                                                  String title,
                                                                  CustomFilterEditor filterEditor)
Create the custom filter editor dialog. This is the dialog that will be used as when the "custom filter" is chosen in the filterable FieldBox. Subclass can override this method to create your own dialog.

Parameters:
container - the container of the dialog
title - the title of the dialog
filterEditor - the corresponding filter editor of the dialog
Returns:
the CustomFilterEditorDialog instance.

createFieldSettingsPanel

protected FieldSettingsPanel createFieldSettingsPanel()
Creates the field settings panel. This is the panel that will be used as the content pane of the field setting dialog. Subclass can override this method to create your own field settings panel.

Returns:
the field settings panel.

createFieldSettingsDialogButtonPanel

protected ButtonPanel createFieldSettingsDialogButtonPanel(StandardDialog dialog)
Creates the button panel in field settings dialog. This is the panel that will be used as the button pane of the field setting dialog. Subclass can override this method to create your own button panel or change the font of the buttons.

By default, we have three buttons: ok, cancel and hide. You can retreive them by getName(). Their names are:

FIELD_SETTING_DIALOG_OK_BUTTON FIELD_SETTING_DIALOG_CANCEL_BUTTON FIELD_SETTING_DIALOG_HIDE_BUTTON

Parameters:
dialog - the FieldSettingDialog instance
Returns:
the button panel of the field settings dialog.

getPopupMenuCustomizer

public PivotTablePane.PopupMenuCustomizer getPopupMenuCustomizer()
Gets the popup menu customizer to customize the menu when user right click on the fields.

Returns:
the popup menu customizer.

setPopupMenuCustomizer

public void setPopupMenuCustomizer(PivotTablePane.PopupMenuCustomizer popupMenuCustomizer)
Sets the popup menu customizer to customize the menu when user right click on the fields.

Parameters:
popupMenuCustomizer - a new PopupMenuCustomizer.

getHeaderTablePopupMenuCustomizer

public PivotTablePane.PopupMenuCustomizer getHeaderTablePopupMenuCustomizer()
Gets the popup menu customizer to customize the menu when user right click on the row or column header tables.

Returns:
the popup menu customizer.

setHeaderTablePopupMenuCustomizer

public void setHeaderTablePopupMenuCustomizer(PivotTablePane.PopupMenuCustomizer popupMenuCustomizer)
Sets the popup menu customizer to customize the menu when user right click on the row or column header tables.

If you want more concise control over the popup menu, please let your class implement PivotTablePane.TablePopupMenuCustomizer. In that case, TablePopupMenuCustomizer will be invoked instead of PopupMenuCustomizer.

Parameters:
popupMenuCustomizer - a new PopupMenuCustomizer.

getDataTablePopupMenuCustomizer

public PivotTablePane.PopupMenuCustomizer getDataTablePopupMenuCustomizer()
Gets the popup menu customizer to customize the menu when user right click on the data table.

Returns:
the popup menu customizer.

setDataTablePopupMenuCustomizer

public void setDataTablePopupMenuCustomizer(PivotTablePane.PopupMenuCustomizer popupMenuCustomizer)
Sets the popup menu customizer to customize the menu when user right click on the data table.

If you want more concise control over the popup menu, please let your class implement PivotTablePane.TablePopupMenuCustomizer. In that case, TablePopupMenuCustomizer will be invoked instead of PopupMenuCustomizer.

Parameters:
popupMenuCustomizer - a new PopupMenuCustomizer.

getAreaName

public static String getAreaName(Locale locale,
                                 int areaType)

getSummaryCount

public static int getSummaryCount()

getSummaryName

public static String getSummaryName(Locale locale,
                                    int summaryType)

setLocale

public void setLocale(Locale l)
Overrides:
setLocale in class Component

isFieldChooserEnabled

public boolean isFieldChooserEnabled()
Checks if the field chooser panel is enabled. If true, user can right click on any field or field area and select "Show Field List" from the popup menu to see the field chooser.

Returns:
true if the field chooser is enabled.

setFieldChooserEnabled

public void setFieldChooserEnabled(boolean fieldChooserEnabled)
Sets whether the field chooser panel is enabled. Please note, even if it is disable, you can still call setFieldChooserVisible(boolean) and set it to true to show it. However end users will not be able to access it through the default user interface when it is disabled.

Parameters:
fieldChooserEnabled - true or false.

isRearrangable

public boolean isRearrangable()

setRearrangable

public void setRearrangable(boolean rearrangable)
Sets the rearrangable flag. If true (default), user can drag the fields and rearrange it. If false, the field layout can only be setup by API. User will not be able to change it.

Parameters:
rearrangable - true or false.

getFieldChooserComboBoxPanel

public JPanel getFieldChooserComboBoxPanel()
Gets the panel for the add to combobox on FieldChooser.

Returns:
the panel.

setFieldChooserFilterFieldVisible

public void setFieldChooserFilterFieldVisible(boolean visible)
Shows or hides the quick filter field which is used to filter the field chooser.

Parameters:
visible - true or false.

isFieldChooserFilterFieldVisible

public boolean isFieldChooserFilterFieldVisible()
Checks if the the quick filter field which is used to filter the field chooser is visible.

Returns:
true if visible. Otherwise, false.

getRowFieldsWidth

public int[] getRowFieldsWidth()
Gets the row field boxes' width as an int array.

Returns:
the field boxes width.

autoResizeAllColumns

public void autoResizeAllColumns()
Auto-resize all table's table column width so that all cell contents are visible.


autoResizeAllColumns

public void autoResizeAllColumns(boolean visibleAreaOnly)
Auto-resize all table's table column width so that all cell contents are visible. But different from autoResizeAllColumns(), this method will resize the visible area only if the parameter is true.

Parameters:
visibleAreaOnly - true to resize to make the visible cells' content visible.

getFieldChooser

public Container getFieldChooser()
Gets the unassigned field chooser. By default, we will add this panel to BorderLayout.AFTER_LINE_ENDS of a BorderLayout panel. You can get it and add it to another panel as long as it is in the same window as the PivotTablePane. The setFieldChooserVisible(boolean) will simply call setVisible on this field chooser. So if you add the field chooser to somewhere else, you need to make sure you response to this call (using ComponentListener) and do the right thing to hide the field chooser.

Returns:
the unassigned field chooser.

getGridColor

public Color getGridColor()
Gets the grid color that is used to paint the grid of the header tables and the data table.

Returns:
the grid color.

setGridColor

public void setGridColor(Color gridColor)
Sets the grid color that is used to paint the grid of the header tables and the data table.

Parameters:
gridColor - the grid color of the data table.

isPlainHeaderTables

public boolean isPlainHeaderTables()
Get the flag indicating the header table painting mode.

Before release 2.6.4, setting this flag to true also means you can select the cells in the header table. Meanwhile, setting this flag to false means you cannot select the cells in the header table.

Since release 2.6.5, we add a new flag headerSelectionMode. So if you were using plain table header and wish to get the original behavior, you also need invoke setHeaderSelectionMode method.

Returns:
true if you want the l&f of the header table be the same with the data table. Otherwise false.
See Also:
setHeaderSelectionMode(int), getHeaderSelectionMode()

setPlainHeaderTables

public void setPlainHeaderTables(boolean plainHeaderTables)
Set the flag indicating the header table painting mode.

Parameters:
plainHeaderTables - the flag
See Also:
isPlainHeaderTables()

isFilterFieldAreaVisible

public boolean isFilterFieldAreaVisible()

setFilterFieldAreaVisible

public void setFilterFieldAreaVisible(boolean filterFieldAreaVisible)

isColumnFieldAreaVisible

public boolean isColumnFieldAreaVisible()

setColumnFieldAreaVisible

public void setColumnFieldAreaVisible(boolean columnFieldAreaVisible)

isRowFieldAreaVisible

public boolean isRowFieldAreaVisible()

setRowFieldAreaVisible

public void setRowFieldAreaVisible(boolean rowFieldAreaVisible)

isDataFieldAreaVisible

public boolean isDataFieldAreaVisible()

setDataFieldAreaVisible

public void setDataFieldAreaVisible(boolean dataFieldAreaVisible)

getFieldAreaMessage

public String getFieldAreaMessage(int areaType)

getFieldAreaName

public String getFieldAreaName(int areaType)

getFieldAreaType

public int getFieldAreaType(String name)

isDataFieldFilterable

public boolean isDataFieldFilterable()
Checks if the data field filterable. If true, you will see a filter button on the FieldBox for data fields.

Returns:
true or false.

setDataFieldFilterable

public void setDataFieldFilterable(boolean dataFieldFilterable)
Sets the data field filterable flag. If true, you will see a filter button on the FieldBox for data fields. By default, it is false.

Parameters:
dataFieldFilterable - true or false.

isRowFieldFilterable

public boolean isRowFieldFilterable()
Checks if the row field filterable. If true, you will see a filter button on the FieldBox for row fields.

Returns:
true or false.

setRowFieldFilterable

public void setRowFieldFilterable(boolean rowFieldFilterable)
Sets the row field filterable flag. If true, you will see a filter button on the FieldBox for row fields. By default, it is true.

Parameters:
rowFieldFilterable - true or false.

isColumnFieldFilterable

public boolean isColumnFieldFilterable()
Checks if the column field filterable. If true, you will see a filter button on the FieldBox for column fields.

Returns:
true or false.

setColumnFieldFilterable

public void setColumnFieldFilterable(boolean columnFieldFilterable)
Sets the column field filterable flag. If true, you will see a filter button on the FieldBox for column fields. By default, it is true.

Parameters:
columnFieldFilterable - true or false.

isSelectedHeaderFilterable

public boolean isSelectedHeaderFilterable(boolean isRowHeader,
                                          int fromRow,
                                          int toRow,
                                          int fromColumn,
                                          int toColumn)

isFiltering

public boolean isFiltering(boolean isRowHeader,
                           int fromRow,
                           int toRow,
                           int fromColumn,
                           int toColumn)
check if the selected field have some rows/columns filtered already

Parameters:
isRowHeader - If it is true, it means it is triggered by a rowHeaderTable, otherwise columnHeaderTable
fromRow - selected minimum row index
toRow - selected maximum row index
fromColumn - selected minimum column index
toColumn - selected maximum column index
Returns:
if the selected fields are in filtering mode. True if some rows or columns are filtered. Otherwise false.

clearFilter

public void clearFilter(boolean isRowHeader,
                        int fromRow,
                        int toRow,
                        int fromColumn,
                        int toColumn)
clear current filters in the selected fields

Parameters:
isRowHeader - If it is true, it means it is triggered by a rowHeaderTable, otherwise columnHeaderTable
fromRow - selected minimum row index
toRow - selected maximum row index
fromColumn - selected minimum column index
toColumn - selected maximum column index

filterSelectedHeaderValues

public void filterSelectedHeaderValues(boolean isRowHeader,
                                       boolean isFilterNotShow,
                                       int fromRow,
                                       int toRow,
                                       int fromColumn,
                                       int toColumn)
filter the selected header values or show only the selected header values

Parameters:
isRowHeader - If it is true, it means it is triggered by a rowHeaderTable, otherwise columnHeaderTable
isFilterNotShow - If it is true, it means it is that the selected values to be filtered, otherwise the selected values to be showed
fromRow - selected minimum row index
toRow - selected maximum row index
fromColumn - selected minimum column index
toColumn - selected maximum column index

selectDataCells

public void selectDataCells(boolean isRowHeader,
                            int rowIndex,
                            int columnIndex)
Selects the data cells based on the selection in the row header or column header.

Parameters:
isRowHeader - true or false.
rowIndex - the cell row index of the header table.
columnIndex - the cell column index of the header table.

selectDataCells

protected void selectDataCells(boolean isRowHeader,
                               int rowIndex,
                               int columnIndex,
                               boolean toggle)
Selects the data cells based on the selection in the row header or column header.

Parameters:
isRowHeader - true or false.
rowIndex - the cell row index of the header table.
columnIndex - the cell column index of the header table.
toggle - the flag to indicate if the selection should be toggled.
Since:
3.3.4

selectDataCellsBetween

public void selectDataCellsBetween(boolean isRowHeader,
                                   int startRowIndex,
                                   int startColumnIndex,
                                   int endRowIndex,
                                   int endColumnIndex)
Selects the data cells based on the selection in multiple row headers or column headers.

Parameters:
isRowHeader - true or false.
startRowIndex - the start cell row index of the header table.
startColumnIndex - the start cell column index of the header table.
endRowIndex - the end cell row index of the header table.
endColumnIndex - the end cell column index of the header table.

selectDataCellsBetween

protected void selectDataCellsBetween(boolean isRowHeader,
                                      int startRowIndex,
                                      int startColumnIndex,
                                      int endRowIndex,
                                      int endColumnIndex,
                                      boolean toggle)
Selects the data cells based on the selection in multiple row headers or column headers.

Parameters:
isRowHeader - true or false.
startRowIndex - the start cell row index of the header table.
startColumnIndex - the start cell column index of the header table.
endRowIndex - the end cell row index of the header table.
endColumnIndex - the end cell column index of the header table.
toggle - the flag to indicate if the selection should be toggled.
Since:
3.3.4

isColumnHidden

public boolean isColumnHidden(int columnIndex)
Check if the column in DataTable is hidden.

Parameters:
columnIndex - the column index in DataTable.
Returns:
true if the column is hidden. Otherwise false.

hideColumns

public void hideColumns(int[] columnIndices)
Hide the columns in DataTable.

Parameters:
columnIndices - the column index array to be hidden

showColumns

public void showColumns(int[] columnIndices)
Show the columns in DataTable.

Parameters:
columnIndices - the column index array to be shown

hideValuesAt

public void hideValuesAt(boolean isRowHeader,
                         int rowIndex,
                         int columnIndex)
Hides the column or the row based on the row index and column index in the row header or column header.

We can only hide the normal values in row field or column field. Data fields hiding is not supported. Summary Values hiding and Grand Total Values hiding are not supported as well

Parameters:
isRowHeader - true or false.
rowIndex - the cell row index of the header table.
columnIndex - the cell column index of the header table.

addHiddenValues

public void addHiddenValues(Values values)
Shows or hides the values based on the selection in the row header or column header.

Please note, this method is thread safe.

Parameters:
values - the Values to be shown or hide.

clearHiddenRowFields

public void clearHiddenRowFields()
Clear hidden header fields.

See Also:
addHiddenRowField(PivotField)

removeHiddenRowField

public void removeHiddenRowField(PivotField field)
Remove hidden header field.

Parameters:
field - the row field to be hidden
See Also:
addHiddenRowField(PivotField)

addHiddenRowField

public void addHiddenRowField(PivotField field)
Add hidden header field. It will just be hidden in the UI while the row field staying in effective.

Parameters:
field - the row field to be hidden

getHiddenRowFields

public PivotField[] getHiddenRowFields()
Get all hidden row fields.

Returns:
all hidden row fields.

removeHiddenValues

public void removeHiddenValues(Values values)
Shows or hides the values based on the selection in the row header or column header.

Please note, this method is thread safe.

Parameters:
values - the Values to be shown or hide.

clearHiddenValues

public void clearHiddenValues()
Shows all the hidden values.

Please note, this method is thread safe.


getScrollPane

public JScrollPane getScrollPane()
Gets the scroll pane used by PivotTablePane.

Returns:
the scroll pane used by PivotTablePane.

getResourceString

public String getResourceString(String key)
Gets the resource string used in PivotTablePane. Subclass can override it to provide their own strings. There are exceptions to the field area name and summary name which you have to override getAreaName(java.util.Locale, int) and getSummaryName(java.util.Locale, int) to provide a different string although they are also defined in the resource bundle.

Specified by:
getResourceString in interface ResourceProvider
Parameters:
key - the resource key
Returns:
the localized string.

convertElementToString

public String convertElementToString(Locale locale,
                                     Object value,
                                     Class<?> clazz,
                                     ConverterContext context)
Converters the element to string and used in FieldBox. By default, if the value is Filter.ALL, we will convert it to GridResource.getResourceBundle(locale).getString("Filter.all"). If the value is Filter.NULL or null, we will convert it to GridResource.getResourceBundle(locale).getString("Filter.null"). Otherwise, we will use ObjectConverterManager to do the conversion.

Parameters:
locale - the locale
value - the value
clazz - the type
context - the converter context.
Returns:
the String converted from the value.

isShrinkDataFieldArea

public boolean isShrinkDataFieldArea()
If true, it will shrink the data field area so that it doesn't go wider than the row header table. if false, the data field area will show all data field boxes in full width.

Returns:
true or false.

setShrinkDataFieldArea

public void setShrinkDataFieldArea(boolean shrinkDataFieldArea)
If true, it will shrink the data field area so that it doesn't go wider than the row header table. if false, the data field area will show all data field boxes in full width.

Parameters:
shrinkDataFieldArea - true or false.

isHideFieldOnDraggingOut

public boolean isHideFieldOnDraggingOut()
Checks if the field box will be hidden when user drags it and drop outside the field areas. It is true by default.

Returns:
true or false.

setHideFieldOnDraggingOut

public void setHideFieldOnDraggingOut(boolean hideFieldOnDraggingOut)
Sets the flag if dragging a field box outside the field area will hide the field. It is true by default. If you set it to false, your user can still hide it by right click to show the popup menu which has a "Hide" menu item or drag it to the unassigned field area to hide it.

Parameters:
hideFieldOnDraggingOut - true or false.

isShowFilterIcon

public boolean isShowFilterIcon()
Checks if the filter icon should be visible on the FieldBox when there is filter for a field.

Returns:
true or false.

setShowFilterIcon

public void setShowFilterIcon(boolean showFilterIcon)
Sets the flag to show the filter icon.

Parameters:
showFilterIcon - true or false.

setFilterIcon

public void setFilterIcon(Icon filterIcon)
Sets the filter icon. This icon is displayed on the FieldBox when there is filter if isShowFilterIcon() returns true.

Parameters:
filterIcon - a new filter icon.

getFilterIcon

public Icon getFilterIcon()
Gets the filter icon. This icon is displayed on the FieldBox when there is filter if isShowFilterIcon() returns true.

Returns:
the filter icon.

setKeepFieldAreaFit

protected void setKeepFieldAreaFit(boolean keepFieldAreaFit)
This is an internally used flag.

Parameters:
keepFieldAreaFit - true or false.

isColumnAutoResizable

public boolean isColumnAutoResizable()
Checks if the columns are auto-resizable. If the columns are auto-resizable, user can double click on the grid line on column table header and the table column will automatically resize to fit in the content of all the cells in that column.

Returns:
true if the columns are auto-resizable.

setColumnAutoResizable

public void setColumnAutoResizable(boolean resizable)
Enable or disable the column auto-resizable.

Parameters:
resizable - true to make columns auto-resizable.

isConsiderRowFieldWidth

public boolean isConsiderRowFieldWidth()
Get the flag if it should consider row field width while auto resizing the row header table columns.

Returns:
the flag.

setConsiderRowFieldWidth

public void setConsiderRowFieldWidth(boolean considerRowFieldWidth)
Set the flag if it should consider row field width while auto resizing the row header table columns.

Parameters:
considerRowFieldWidth - the flag

getDragRemoveCursor

public Cursor getDragRemoveCursor()
Get the cursor to be displayed when the field is going to be removed from current area.

Returns:
the cursor.

setDragRemoveCursor

public void setDragRemoveCursor(Cursor dragRemoveCursor)
Set the cursor to be displayed when the field is going to be removed from current area.

Parameters:
dragRemoveCursor - the cursor.

getDragNoDropCursor

public Cursor getDragNoDropCursor()
Get the cursor to be displayed when the field is prohibited to be dropped into current area.

Returns:
the cursor.
See Also:
FieldBoxInputListener.isDropAllowed(java.awt.Component, java.awt.Rectangle, int, java.awt.Container)

setDragNoDropCursor

public void setDragNoDropCursor(Cursor dragNoDropCursor)
Set the cursor to be displayed when the field is prohibited to be dropped into current area.

Parameters:
dragNoDropCursor - the cursor.
See Also:
FieldBoxInputListener.isDropAllowed(java.awt.Component, java.awt.Rectangle, int, java.awt.Container)

isRespectFieldPreferredWidth

public boolean isRespectFieldPreferredWidth()
Get the flag indicating if the column width will respect the preferred width defined in PivotField.

By default, this flag is false to keep the original behavior. You can set it to true if you want to adjust the width of the table by setting the preferred width in PivotField.

Returns:
true if you want the column width in PivotTablePane respect the preferred width in PivotField. Otherwise false.

setRespectFieldPreferredWidth

public void setRespectFieldPreferredWidth(boolean respectFieldPreferredWidth)
Set the flag indicating if the column width will respect the preferred width defined in PivotField.

Parameters:
respectFieldPreferredWidth - the flag

getHeaderSelectionMode

public int getHeaderSelectionMode()
Get the flag indicating the selection mode while clicking on the header table.

Returns:
the flag which would be PivotConstants.HEADER_SELECTION_DATA_TABLE_ONLY or PivotConstants.HEADER_SELECTION_HEADER_TABLE_ONLY.
See Also:
PivotConstants.HEADER_SELECTION_DATA_TABLE_ONLY, PivotConstants.HEADER_SELECTION_HEADER_TABLE_ONLY

setHeaderSelectionMode

public void setHeaderSelectionMode(int headerSelectionMode)
Set the flag indicating the selection mode while clicking on the header table.

Parameters:
headerSelectionMode - the flag

isHideExpandIconOnSingleRow

public boolean isHideExpandIconOnSingleRow()
Get the flag indicating if the expand icon should be hidden if the row only contains one child.

By default, the value is true, which is a different behavior with the release earlier than 2.8.3. You could set this flag to false if you want to keep the original behavior.

Returns:
true if the expand icon should be hidden in one child row scenario. Otherwise false.

setHideExpandIconOnSingleRow

public void setHideExpandIconOnSingleRow(boolean hideExpandIconOnSingleRow)
Set the flag indicating if the expand icon should be hidden if the row only contains one child.

Parameters:
hideExpandIconOnSingleRow - the flag
See Also:
isHideExpandIconOnSingleRow()

stopCellEditing

public void stopCellEditing()
Stops the cell editing in case the tables in PivotTablePane is in editing mode.


isScrollSelectionToVisible

public boolean isScrollSelectionToVisible()
Get the flag indicating if PivotTablePane should scroll the selection to visible while loading selections. The loading selection behavior happens each time field rearrangement, expanding/expanding, sorting, etc.

The default value of this flag is true.

Returns:
true if selection should be scrolled to visible. Otherwise false.
See Also:
setScrollSelectionToVisible(boolean)

setScrollSelectionToVisible

public void setScrollSelectionToVisible(boolean scrollSelectionToVisible)
Set the flag indicating if PivotTablePane should scroll the selection to visible while loading selections.

Parameters:
scrollSelectionToVisible - the flag

isFlatLayout

public boolean isFlatLayout()
Gets the flag indicating if the flat layout is in use.

Returns:
true if the flag layout is in use. Otherwise false.
Since:
3.3.3
See Also:
setFlatLayout(boolean)

setFlatLayout

public void setFlatLayout(boolean flatLayout)
Sets the flag indicating if the flat layout is in use.

By default, this flag is false to keep backward compatibility. If you have a very long list of row fields, please consider set this flag to true so that the row header table would also be able to be scrolled.

Parameters:
flatLayout - the flag
Since:
3.3.3

saveSelection

public Object[] saveSelection()
Save the selection of the DataTable part of the PivotTablePane as an array of Values. It works for all cases either row selection is allowed or column selection or cell selection is allowed. However you cannot change the row/column selection allowed attribute for DataTable between saveSelection and loadSelection.

Returns:
selection as an array

loadSelection

public void loadSelection(Object[] selectedKeyValues)
Restore the selection in the DataTable part of the PivotTablePane. It must use the array created by saveSelection.

Parameters:
selectedKeyValues - an Values array created by saveSelection

loadSelection

public void loadSelection(Object[] selectedKeyValues,
                          boolean scrollSelectionToVisible)
Restore the selection in the DataTable part of the PivotTablePane. It must use the array created by saveSelection.

Parameters:
selectedKeyValues - an Values array created by saveSelection
scrollSelectionToVisible - if the DataTable is row selection mode and this flag is true, this method will

loadSelection

public void loadSelection(Object[] selectedKeyValues,
                          boolean scrollSelectionToVisible,
                          boolean selectParentNode)
Restore the selection in the DataTable part of the PivotTablePane. It must use the array created by saveSelection.

Parameters:
selectedKeyValues - an Values array created by saveSelection
scrollSelectionToVisible - if the DataTable is row selection mode and this flag is true, this method will scroll
selectParentNode - if load selection should find its parent node if the pre-selected node is collapsed

isShowFilterButtonsOnMouseOver

public boolean isShowFilterButtonsOnMouseOver()
Gets the flag indicating if the filter buttons in FieldBox should be displayed always or only when the mouse is over the button.

Returns:
true if the filter buttons should only be displayed when the mouse is over the button. Otherwise false.
Since:
3.4.0
See Also:
setShowFilterButtonsOnMouseOver(boolean)

setShowFilterButtonsOnMouseOver

public void setShowFilterButtonsOnMouseOver(boolean showFilterButtonsOnMouseOver)
Sets the flag indicating if the filter buttons in FieldBox should be displayed always or only when the mouse is over the button.

By default, the value is false to keep the default behavior backward compatibility.

Parameters:
showFilterButtonsOnMouseOver - the flag
Since:
3.4.0

isDataFieldsDuplicationEnabled

public boolean isDataFieldsDuplicationEnabled()
Gets the flag indicating if the data fields could be duplicated.

Returns:
true if the data fields could be duplicated. Otherwise false.
Since:
3.4.1
See Also:
setDataFieldsDuplicationEnabled(boolean)

setDataFieldsDuplicationEnabled

public void setDataFieldsDuplicationEnabled(boolean dataFieldsDuplicationEnabled)
Sets the flag indicating if the data fields could be duplicated.

By default, the flag is false.

Parameters:
dataFieldsDuplicationEnabled - the flag
Since:
3.4.1

JIDE 3.5.15