Class SpreadSheetPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.tools.spreadsheetviewer.SpreadSheetPanel
-
- All Implemented Interfaces:
CleanUpHandler,SpreadSheetSupporter,KnownParentSupporter,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,TableModelListener
public class SpreadSheetPanel extends BasePanel implements SpreadSheetSupporter, TableModelListener, CleanUpHandler, KnownParentSupporter
Encapsulates a panel for the spreadsheet viewer tool.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected SpreadSheetColumnComboBoxm_ColumnComboBoxfor listing the column names.protected Filem_Filenamethe associated file name.protected booleanm_GarbageCollectionOnClosewhether to apply GC during cleanup.protected List<Flow>m_GeneratedFlowsthe generated flows (eg charts).protected MultiPagePanem_Ownerthe owning tabbed pane.protected SearchPanelm_PanelSearchthe search panel.protected SpreadSheetReaderm_Readerthe reader used for reading the file.protected SpreadSheetTablem_Tablethe underlying table.protected SpreadSheetWriterm_Writerthe writer used for writing the file.-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description SpreadSheetPanel(MultiPagePane owner)Initializes the panel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGeneratedFlow(Flow flow)Adds the flow to the list of flows to clean up.voidcleanUp()Cleans up data structures, frees up memory.voidgenerateChart(AbstractChartGenerator generator)Generates and displays a chart using the specified chart generator.CellRenderingCustomizergetCellRenderingCustomizer()Returns the cell rendering customizer.FilegetFilename()Returns the associated filename.booleangetGarbageCollectionOnClose()Returns whether to run garbage collection on cleanup.ContainergetKnownParent()Returns the component that acts as this component's parent.intgetNumDecimals()Returns the currently set number of decimals. -1 if displaying all.MultiPagePanegetOwner()Returns the owning tabbed pane.SpreadSheetReadergetReader()Returns the associated reader.SpreadSheetgetSheet()Returns the underlying spreadsheet.booleangetShowCellTypes()Returns whether to show the cell types rather than the cell values.booleangetShowFormulas()Returns whether to display the formulas or their calculated values.SpreadSheetTablegetTable()Returns the underlying table.StringgetTabTitle()Returns this panel's tab title, if any.SpreadSheetViewerPanelgetViewer()Returns the owning viewer.SpreadSheetWritergetWriter()Returns the associated writer.protected voidinitGUI()Initializes the widgets.protected voidinitialize()initializes the members.booleanisModified()Returns whether the table has been modified.booleanisReadOnly()Returns whether the table is read-only.voidsetCellRenderingCustomizer(CellRenderingCustomizer value)Sets the cell rendering customizer.voidsetFilename(File value)Sets the associated filename.voidsetGarbageCollectionOnClose(boolean value)Sets whether to run garbage collection on cleanup.voidsetModified(boolean value)Sets whether the table has been modified.voidsetNumDecimals(int value)Sets the number of decimals to display.voidsetOwner(MultiPagePane value)Sets the owning tabbed pane.voidsetReader(SpreadSheetReader value)Sets the associated reader.voidsetReadOnly(boolean value)Sets whether the table is read-only.voidsetSheet(SpreadSheet value)Sets the spreadsheet to display.voidsetShowCellTypes(boolean value)Sets whether to show the cell types rather than the cell values.voidsetShowFormulas(boolean value)Sets whether to display the formulas or their calculated values.voidsetWriter(SpreadSheetWriter value)Sets the associated writer.voidtableChanged(TableModelEvent e)Gets notified in case of changes to the table model.SpreadSheettoSpreadSheet()Returns the underlying sheet.SpreadSheettoSpreadSheet(TableRowRange range)Returns the underlying sheet.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, closeParent, finishInit, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, main, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
m_Owner
protected MultiPagePane m_Owner
the owning tabbed pane.
-
m_Table
protected SpreadSheetTable m_Table
the underlying table.
-
m_ColumnComboBox
protected SpreadSheetColumnComboBox m_ColumnComboBox
for listing the column names.
-
m_PanelSearch
protected SearchPanel m_PanelSearch
the search panel.
-
m_Filename
protected File m_Filename
the associated file name.
-
m_Reader
protected SpreadSheetReader m_Reader
the reader used for reading the file.
-
m_Writer
protected SpreadSheetWriter m_Writer
the writer used for writing the file.
-
m_GarbageCollectionOnClose
protected boolean m_GarbageCollectionOnClose
whether to apply GC during cleanup.
-
-
Constructor Detail
-
SpreadSheetPanel
public SpreadSheetPanel(MultiPagePane owner)
Initializes the panel.- Parameters:
owner- the owning tabbed pane
-
-
Method Detail
-
initialize
protected void initialize()
initializes the members.- Overrides:
initializein classBasePanel
-
setOwner
public void setOwner(MultiPagePane value)
Sets the owning tabbed pane.- Parameters:
value- the owner
-
getOwner
public MultiPagePane getOwner()
Returns the owning tabbed pane.- Returns:
- the owner, null if none set
-
getKnownParent
public Container getKnownParent()
Returns the component that acts as this component's parent.- Specified by:
getKnownParentin interfaceKnownParentSupporter- Returns:
- the parent, null if not available
-
getTabTitle
public String getTabTitle()
Returns this panel's tab title, if any.- Returns:
- the title, null if not available
-
getViewer
public SpreadSheetViewerPanel getViewer()
Returns the owning viewer.- Returns:
- the viewer, null if none set
-
setNumDecimals
public void setNumDecimals(int value)
Sets the number of decimals to display. Use -1 to display all.- Parameters:
value- the number of decimals
-
getNumDecimals
public int getNumDecimals()
Returns the currently set number of decimals. -1 if displaying all.- Returns:
- the number of decimals
-
setCellRenderingCustomizer
public void setCellRenderingCustomizer(CellRenderingCustomizer value)
Sets the cell rendering customizer.- Parameters:
value- the customizer
-
getCellRenderingCustomizer
public CellRenderingCustomizer getCellRenderingCustomizer()
Returns the cell rendering customizer.- Returns:
- the customizer
-
setShowFormulas
public void setShowFormulas(boolean value)
Sets whether to display the formulas or their calculated values.- Parameters:
value- true if to display the formulas rather than the calculated values
-
getShowFormulas
public boolean getShowFormulas()
Returns whether to display the formulas or their calculated values.- Returns:
- true if to display the formulas rather than the calculated values
-
setReadOnly
public void setReadOnly(boolean value)
Sets whether the table is read-only.- Parameters:
value- true if read-only
-
isReadOnly
public boolean isReadOnly()
Returns whether the table is read-only.- Returns:
- true if read-only
-
setModified
public void setModified(boolean value)
Sets whether the table has been modified.- Parameters:
value- true if modified
-
isModified
public boolean isModified()
Returns whether the table has been modified.- Returns:
- true if modified
-
setShowCellTypes
public void setShowCellTypes(boolean value)
Sets whether to show the cell types rather than the cell values.- Parameters:
value- true if to show cell types
-
getShowCellTypes
public boolean getShowCellTypes()
Returns whether to show the cell types rather than the cell values.- Returns:
- true if showing the cell types
-
getTable
public SpreadSheetTable getTable()
Returns the underlying table.- Returns:
- the table
-
setSheet
public void setSheet(SpreadSheet value)
Sets the spreadsheet to display.- Parameters:
value- the sheet
-
getSheet
public SpreadSheet getSheet()
Returns the underlying spreadsheet.- Returns:
- the sheet
-
toSpreadSheet
public SpreadSheet toSpreadSheet()
Returns the underlying sheet.- Specified by:
toSpreadSheetin interfaceSpreadSheetSupporter- Returns:
- the spread sheet
-
toSpreadSheet
public SpreadSheet toSpreadSheet(TableRowRange range)
Returns the underlying sheet.- Parameters:
range- the range to return- Returns:
- the spread sheet
-
generateChart
public void generateChart(AbstractChartGenerator generator)
Generates and displays a chart using the specified chart generator.- Parameters:
generator- the generator to use for creating the chart
-
addGeneratedFlow
public void addGeneratedFlow(Flow flow)
Adds the flow to the list of flows to clean up.- Parameters:
flow- the flow to clean up
-
setFilename
public void setFilename(File value)
Sets the associated filename.- Parameters:
value- the file
-
getFilename
public File getFilename()
Returns the associated filename.- Returns:
- the file
-
setReader
public void setReader(SpreadSheetReader value)
Sets the associated reader.- Parameters:
value- the reader
-
getReader
public SpreadSheetReader getReader()
Returns the associated reader.- Returns:
- the reader
-
setWriter
public void setWriter(SpreadSheetWriter value)
Sets the associated writer.- Parameters:
value- the writer
-
getWriter
public SpreadSheetWriter getWriter()
Returns the associated writer.- Returns:
- the writer
-
setGarbageCollectionOnClose
public void setGarbageCollectionOnClose(boolean value)
Sets whether to run garbage collection on cleanup.- Parameters:
value- true if to run
-
getGarbageCollectionOnClose
public boolean getGarbageCollectionOnClose()
Returns whether to run garbage collection on cleanup.- Returns:
- true if to run
-
tableChanged
public void tableChanged(TableModelEvent e)
Gets notified in case of changes to the table model.- Specified by:
tableChangedin interfaceTableModelListener- Parameters:
e- the event
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUpin interfaceCleanUpHandler
-
-