org.openswing.swing.pivottable.client
Class PivotTable

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.openswing.swing.pivottable.client.PivotTable
All Implemented Interfaces:
javax.accessibility.Accessible, DataController, DraggableButtonListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public final class PivotTable
extends javax.swing.JPanel
implements DataController, DraggableButtonListener

Title: OpenSwing Framework

Description: pivot table.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static java.lang.String COLUMNS_PANEL
           
static java.lang.String DATA_PANEL
           
static java.lang.String ROWS_PANEL
           
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
PivotTable()
           
 
Method Summary
 void addColumnField(ColumnField columnField)
          Add a column name as column field in Pivot Table.
 void addColumnField(int index, ColumnField columnField)
          Add a column name as column field in Pivot Table.
 void addDataField(DataField dataField)
          Add a column name as data field in Pivot Table.
 void addDataField(int index, DataField dataField)
          Add a column name as data field in Pivot Table.
 void addNotify()
          Method automatically invoked when this panel is showed.
 void addRowField(int index, RowField rowField)
          Add a column name as row field in Pivot Table.
 void addRowField(RowField rowField)
          Add a column name as row field in Pivot Table.
 void collapseColumn(int column)
          Collapse all column fields, starting from the specified column index.
 void collapseRow(int row)
          Collapse all rows fields, starting from the specified row index.
 void compileData()
          Method invoked to re-analyze data model and show data in Pivot Table.
 void compileDataInThread()
          Method invoked to re-analyze data model and show data in Pivot Table.
 void copy()
          Method called when used has clicked on copy button.
 void delete()
          Method called when used has clicked on delete button.
 void dragEventFired(DraggableButtonEvent e)
           
 void edit()
          Method called when used has clicked on edit button.
 void expandColumn(int column)
          Expand all column fields, starting from the specified column index.
 void expandRow(int row)
          Expand all rows fields, starting from the specified row index.
 void export()
          Invoked when pressing export button.
 void filterSort()
          Invoked when pressing filter button.
 java.util.ArrayList getAllColumnFields()
           
 java.util.ArrayList getAllDataFields()
           
 java.util.ArrayList getAllRowFields()
           
 java.util.HashSet getBindedButtons()
           
 boolean getCurrentValue(GenericButton button)
           
 DataFieldRenderer getDataFieldRenderer()
           
 ExportButton getExportButton()
           
 FilterButton getFilterButton()
           
 java.lang.String getFunctionId()
           
 PivotTableParameters getPivotTableParameters()
           
 ReloadButton getReloadButton()
           
 int getSelectedColumn()
           
 int getSelectedRow()
           
 void importData()
          Method called when used has clicked on import button.
 void insert()
          Method called when used has clicked on insert button.
 boolean isAutoCompile()
           
 boolean isButtonDisabled(GenericButton button)
           
 void reload()
          Invoked when pressing reload button.
 void removeColumnField(ColumnField columnField)
          Remove a column name as column field in Pivot Table.
 void removeDataField(DataField dataField)
          Remove a column name as data field in Pivot Table.
 void removeRowField(RowField rowField)
          Remove a column name as row field in Pivot Table.
 boolean save()
          Method called when used has clicked on save button.
 void setAutoCompile(boolean autoCompile)
          Set whether autocompile Pivot table when showing it.
 void setController(PivotTableController controller)
          Set the controller used by PivotTable to retrieve the PivotTableModel
 void setCurrentValue(GenericButton button, boolean currentValue)
          Set current enabled value of button.
 void setDataFieldRenderer(DataFieldRenderer dataFieldRenderer)
          Set the renderer used to set background/foreground color for each data field cell and related font.
 void setExportButton(ExportButton exportButton)
           
 void setFilterButton(FilterButton filterButton)
           
 void setFunctionId(java.lang.String functionId)
          Set the functionId identifier, associated to the container
 void setInputFilter(InputFilter rowFilter)
          Set the row filter, used to skip rows from original data model.
 void setReloadButton(ReloadButton reloadButton)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA_PANEL

public static final java.lang.String DATA_PANEL
See Also:
Constant Field Values

ROWS_PANEL

public static final java.lang.String ROWS_PANEL
See Also:
Constant Field Values

COLUMNS_PANEL

public static final java.lang.String COLUMNS_PANEL
See Also:
Constant Field Values
Constructor Detail

PivotTable

public PivotTable()
Method Detail

addNotify

public final void addNotify()
Method automatically invoked when this panel is showed.


getPivotTableParameters

public final PivotTableParameters getPivotTableParameters()
Returns:
Pivot Table parameters, used to create PivotTable content

setController

public final void setController(PivotTableController controller)
Set the controller used by PivotTable to retrieve the PivotTableModel

Parameters:
controller - controller used by PivotTable to retrieve the PivotTableModel

addRowField

public final void addRowField(RowField rowField)
Add a column name as row field in Pivot Table.

Parameters:
rowField - row field

addRowField

public final void addRowField(int index,
                              RowField rowField)
Add a column name as row field in Pivot Table.

Parameters:
index - column index to use to insert row field
rowField - row field

removeRowField

public final void removeRowField(RowField rowField)
Remove a column name as row field in Pivot Table.

Parameters:
rowField - row field

addColumnField

public final void addColumnField(ColumnField columnField)
Add a column name as column field in Pivot Table.

Parameters:
columnField - column field

addColumnField

public final void addColumnField(int index,
                                 ColumnField columnField)
Add a column name as column field in Pivot Table.

Parameters:
index - column index to use to insert column field
columnField - column field

removeColumnField

public final void removeColumnField(ColumnField columnField)
Remove a column name as column field in Pivot Table.

Parameters:
columnField - column field

addDataField

public final void addDataField(DataField dataField)
Add a column name as data field in Pivot Table.

Parameters:
dataField - data field

addDataField

public final void addDataField(int index,
                               DataField dataField)
Add a column name as data field in Pivot Table.

Parameters:
index - column index to use to insert data field
dataField - data field

removeDataField

public final void removeDataField(DataField dataField)
Remove a column name as data field in Pivot Table.

Parameters:
dataField - data field

compileDataInThread

public final void compileDataInThread()
Method invoked to re-analyze data model and show data in Pivot Table. Data analysis is perfomed in a separated thread, in order to avoid to block application usage.


dragEventFired

public final void dragEventFired(DraggableButtonEvent e)
Specified by:
dragEventFired in interface DraggableButtonListener

compileData

public final void compileData()
Method invoked to re-analyze data model and show data in Pivot Table.


setInputFilter

public final void setInputFilter(InputFilter rowFilter)
Set the row filter, used to skip rows from original data model.

Parameters:
rowFilter - row filter

getFilterButton

public FilterButton getFilterButton()

setFilterButton

public void setFilterButton(FilterButton filterButton)

getExportButton

public ExportButton getExportButton()

setExportButton

public void setExportButton(ExportButton exportButton)

getReloadButton

public ReloadButton getReloadButton()

setReloadButton

public void setReloadButton(ReloadButton reloadButton)

copy

public final void copy()
Description copied from interface: DataController
Method called when used has clicked on copy button.

Specified by:
copy in interface DataController

delete

public final void delete()
Description copied from interface: DataController
Method called when used has clicked on delete button.

Specified by:
delete in interface DataController

edit

public final void edit()
Description copied from interface: DataController
Method called when used has clicked on edit button.

Specified by:
edit in interface DataController

export

public final void export()
Invoked when pressing export button.

Specified by:
export in interface DataController

filterSort

public final void filterSort()
Invoked when pressing filter button.

Specified by:
filterSort in interface DataController

getBindedButtons

public final java.util.HashSet getBindedButtons()
Specified by:
getBindedButtons in interface DataController
Returns:
collection of buttons binded to grid (InsertButton, EditButton, etc)

setCurrentValue

public final void setCurrentValue(GenericButton button,
                                  boolean currentValue)
Set current enabled value of button.

Specified by:
setCurrentValue in interface DataController
Parameters:
button - generic button that fires this event
currentValue - current enabled value

getCurrentValue

public final boolean getCurrentValue(GenericButton button)
Specified by:
getCurrentValue in interface DataController
Parameters:
button - generic button
Returns:
current enabled value

setFunctionId

public final void setFunctionId(java.lang.String functionId)
Set the functionId identifier, associated to the container

Parameters:
functionId - identifier associated to the container

getFunctionId

public final java.lang.String getFunctionId()
Specified by:
getFunctionId in interface DataController
Returns:
identifier (functionId) associated to the container

importData

public final void importData()
Description copied from interface: DataController
Method called when used has clicked on import button.

Specified by:
importData in interface DataController

insert

public final void insert()
Description copied from interface: DataController
Method called when used has clicked on insert button.

Specified by:
insert in interface DataController

isButtonDisabled

public final boolean isButtonDisabled(GenericButton button)
Specified by:
isButtonDisabled in interface DataController
Parameters:
button - button whose abilitation must be checked
Returns:
true if no policy is defined in the form/grid for the specified button, false if there exists a disabilitation policy for the specified button (through addButtonsNotEnabledOnState form/grid method)

reload

public final void reload()
Invoked when pressing reload button.

Specified by:
reload in interface DataController

save

public final boolean save()
Description copied from interface: DataController
Method called when used has clicked on save button.

Specified by:
save in interface DataController

getAllColumnFields

public final java.util.ArrayList getAllColumnFields()
Returns:
column fields decleared for this pivot table; they are not applied, but are only showed in filter dialog

getAllDataFields

public final java.util.ArrayList getAllDataFields()
Returns:
data fields decleared for this pivot table; they are not applied, but are only showed in filter dialog

getAllRowFields

public final java.util.ArrayList getAllRowFields()
Returns:
row fields decleared for this pivot table; they are not applied, but are only showed in filter dialog

isAutoCompile

public final boolean isAutoCompile()
Returns:
flag used to autocompile Pivot table when showing it

setAutoCompile

public final void setAutoCompile(boolean autoCompile)
Set whether autocompile Pivot table when showing it.

Parameters:
autoCompile - flag used to autocompile Pivot table when showing it

getDataFieldRenderer

public final DataFieldRenderer getDataFieldRenderer()
Returns:
(optional) renderer used to set background/foreground color for each data field cell and related font

setDataFieldRenderer

public final void setDataFieldRenderer(DataFieldRenderer dataFieldRenderer)
Set the renderer used to set background/foreground color for each data field cell and related font.

Parameters:
dataFieldRenderer - renderer used to set background/foreground color for each data field cell and related font

expandRow

public final void expandRow(int row)
Expand all rows fields, starting from the specified row index.

Parameters:
row - row index to expand

collapseRow

public final void collapseRow(int row)
Collapse all rows fields, starting from the specified row index.

Parameters:
row - row index to collapse

expandColumn

public final void expandColumn(int column)
Expand all column fields, starting from the specified column index.

Parameters:
column - column index to expand

collapseColumn

public final void collapseColumn(int column)
Collapse all column fields, starting from the specified column index.

Parameters:
column - column index to collapse

getSelectedRow

public final int getSelectedRow()
Returns:
current selected row in data table

getSelectedColumn

public final int getSelectedColumn()
Returns:
current selected column in data table