com.jstatcom.table
Class JSCDataTableScrollPane
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JScrollPane
-
- com.jstatcom.table.JSCDataTableScrollPane
-
- All Implemented Interfaces:
- java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.ScrollPaneConstants
public class JSCDataTableScrollPane extends javax.swing.JScrollPaneSpecial scrollpane to be used with data tables. It can listen to data objects to be displayed as column and/or row header.The layout manager preserves space for scrollbars and row/column headers if there is a theoretical chance for them to appear. The appearance can be adjusted by setting min/max visible rows/cols.
- minimumVisibleRows/Cols: no less than 'minimumVisibleRows' are displayed if there is not enough data to display, space is reserved.
- maximumVisibleRows/cols: no more than 'maximumVisibleRows' are displayed if there is not enough space, display as much rows as possible.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Field Summary
-
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 javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
-
-
Constructor Summary
Constructors Constructor and Description JSCDataTableScrollPane()Creates a default scroll pane table withJSCDataTableScrollPaneLayout.JSCDataTableScrollPane(JSCAbstractDataTable dataTable)Creates a scroll pane table withJSCDataTableScrollPaneLayoutandgdtas viewport.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetColumnHeaderAlignment()Gets the alignment of the column header.javax.swing.table.TableCellRenderergetColumnHeaderCellRenderer()Gets the current column header cell renderer.JSCSArraygetColumnHeaderData()Gets the data object used for the column header.booleangetColumnHeaderShowing()Gets whether the column header should be displayed.java.lang.String[]getColumnHeaderStringData()Gets a reference to the string array used for the column header.java.lang.StringgetColumnHeaderSymbolName()Gets the symbol name for theSARRAYcolumn header data.intgetMaximumVisibleColumns()Gets the maximum number of cols that are displayed without scrolling.intgetMaximumVisibleRows()Gets the maximum number of rows that are displayed without scrolling.intgetMinimumVisibleColumns()Gets the minimum number of columns that are displayed without scrolling.intgetMinimumVisibleRows()Gets the minimum number of rows that are displayed without scrolling.intgetRowHeaderAlignment()Gets the alignment of the column header.javax.swing.table.TableCellRenderergetRowHeaderCellRenderer()Gets the current row header cell renderer.JSCSArraygetRowHeaderData()Gets the data object used for the row header.booleangetRowHeaderShowing()Gets whether the row header should be displayed.java.lang.StringgetRowHeaderSymbolName()Gets the symbol name for theSARRAYrow header data.ScopegetSymbolScope()Gets which symbol scope is used.SymbolTablegetSymbolTable()Gets the symbol table that has been set for row and column header.voidsetColumnHeaderAlignment(int newColumnHeaderAlignment)Sets the column header alignment, the default isJLabel.RIGHT.voidsetColumnHeaderCellRenderer(javax.swing.table.TableCellRenderer newColumnHeaderCellRenderer)Sets a new cell renderer for the column header.voidsetColumnHeaderData(JSCSArray newColumnHeaderData)Sets the data object used for the column header.voidsetColumnHeaderShowing(boolean isShowing)Sets whether the column header should be displayed.voidsetColumnHeaderStringData(java.lang.String[] colHeaderStringData)Sets the column header data from a string array.voidsetColumnHeaderSymbolName(java.lang.String newColumnHeaderSymbolName)Sets the symbol name for theSARRAYcolumn header data.voidsetMaximumVisibleColumns(int newMaximumVisibleColumns)Sets the maximum number of visible cols that this scrollpane shows.voidsetMaximumVisibleRows(int newMaximumVisibleRows)Sets the maximum number of visible rows that this scrollpane shows.voidsetMinimumVisibleColumns(int newMinimumVisibleColumns)Sets the minimum number of visible cols that this scrollpane shows without scrolling.voidsetMinimumVisibleRows(int newMinimumVisibleRows)Sets the minimum number of visible rows that this scrollpane shows without scrolling.voidsetRowHeaderAlignment(int newRowHeaderAlignment)Sets the row header alignment, the default isJLabel.RIGHT.voidsetRowHeaderCellRenderer(javax.swing.table.TableCellRenderer newRowHeaderCellRenderer)Sets a new cell renderer for the row header.voidsetRowHeaderData(JSCSArray newRowHeaderData)Sets the data object used for the row header.voidsetRowHeaderShowing(boolean isShowing)Sets whether the row header should be displayed.voidsetRowHeaderSymbolName(java.lang.String newRowHeaderSymbolName)Sets the symbol name for theSARRAYrow header data.voidsetSymbolScope(Scope newSymbolScope)Sets the scope for the symbols used for row and column header.voidsetSymbolTable(SymbolTable table)Sets the symbol table used for row and column header data.voidsetViewportView(java.awt.Component view)Overwrites supermethod to handle data table components specially.-
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setWheelScrollingEnabled, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isPaintingTile, isRequestFocusEnabled, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, 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, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
JSCDataTableScrollPane
public JSCDataTableScrollPane()
Creates a default scroll pane table withJSCDataTableScrollPaneLayout.
-
JSCDataTableScrollPane
public JSCDataTableScrollPane(JSCAbstractDataTable dataTable)
Creates a scroll pane table withJSCDataTableScrollPaneLayoutandgdtas viewport.- Parameters:
dataTable- the datatable to be used a viewport
-
-
Method Detail
-
getColumnHeaderAlignment
public int getColumnHeaderAlignment()
Gets the alignment of the column header.- Returns:
- JLabel.RIGHT, JLabel.LEFT or JLabel.CENTER
-
getColumnHeaderCellRenderer
public javax.swing.table.TableCellRenderer getColumnHeaderCellRenderer()
Gets the current column header cell renderer. If none is set, the default renderer is returned.- Returns:
- javax.swing.table.TableCellRenderer
-
getColumnHeaderData
public JSCSArray getColumnHeaderData()
Gets the data object used for the column header.- Returns:
- column data
-
getColumnHeaderStringData
public java.lang.String[] getColumnHeaderStringData()
Gets a reference to the string array used for the column header.- Returns:
- column header string array
-
getColumnHeaderSymbolName
public java.lang.String getColumnHeaderSymbolName()
Gets the symbol name for theSARRAYcolumn header data.- Returns:
- the symbol identifier
-
getMaximumVisibleColumns
public int getMaximumVisibleColumns()
Gets the maximum number of cols that are displayed without scrolling. The component will not grow beyond but display a horizontal scrollbar if there are more columns to display.- Returns:
- int
-
getMaximumVisibleRows
public int getMaximumVisibleRows()
Gets the maximum number of rows that are displayed without scrolling. The component will not grow beyond but display a vertical scrollbar if there are more rows to display.- Returns:
- int
-
getMinimumVisibleColumns
public int getMinimumVisibleColumns()
Gets the minimum number of columns that are displayed without scrolling.- Returns:
- int
-
getMinimumVisibleRows
public int getMinimumVisibleRows()
Gets the minimum number of rows that are displayed without scrolling.- Returns:
- int
-
getRowHeaderAlignment
public int getRowHeaderAlignment()
Gets the alignment of the column header.- Returns:
- JLabel.RIGHT, JLabel.LEFT or JLabel.CENTER
-
getRowHeaderCellRenderer
public javax.swing.table.TableCellRenderer getRowHeaderCellRenderer()
Gets the current row header cell renderer. If none is set, the default renderer is returned.- Returns:
- javax.swing.table.TableCellRenderer
-
getRowHeaderData
public JSCSArray getRowHeaderData()
Gets the data object used for the row header.- Returns:
- row data
-
getRowHeaderSymbolName
public java.lang.String getRowHeaderSymbolName()
Gets the symbol name for theSARRAYrow header data.- Returns:
- the symbol identifier
-
getSymbolScope
public Scope getSymbolScope()
Gets which symbol scope is used.- Returns:
- the symbol scope
-
setColumnHeaderAlignment
public void setColumnHeaderAlignment(int newColumnHeaderAlignment)
Sets the column header alignment, the default isJLabel.RIGHT.- Parameters:
newColumnHeaderAlignment- JLabel.LEFT, JLabel.RIGHT or JLabel.CENTER- Throws:
java.lang.IllegalArgumentException- if argument is not valid
-
setColumnHeaderCellRenderer
public void setColumnHeaderCellRenderer(javax.swing.table.TableCellRenderer newColumnHeaderCellRenderer)
Sets a new cell renderer for the column header.- Parameters:
newColumnHeaderCellRenderer-
-
setColumnHeaderData
public void setColumnHeaderData(JSCSArray newColumnHeaderData)
Sets the data object used for the column header.Please note:
The data is presented transposed. This is for convenience, because often names are stored as column vectors in the symbol table. This behaviour does not occur if the data is explicitely set.- Parameters:
newColumnHeaderData- row data
-
setColumnHeaderShowing
public void setColumnHeaderShowing(boolean isShowing)
Sets whether the column header should be displayed.- Parameters:
isShowing-trueif showing
-
getColumnHeaderShowing
public boolean getColumnHeaderShowing()
Gets whether the column header should be displayed.- Returns:
trueif showing
-
setRowHeaderShowing
public void setRowHeaderShowing(boolean isShowing)
Sets whether the row header should be displayed.- Parameters:
isShowing-trueif showing
-
getRowHeaderShowing
public boolean getRowHeaderShowing()
Gets whether the row header should be displayed.- Returns:
trueif showing
-
setColumnHeaderStringData
public void setColumnHeaderStringData(java.lang.String[] colHeaderStringData)
Sets the column header data from a string array. This is useful, if the header is fixed.- Parameters:
colHeaderStringData- string array with column names
-
setColumnHeaderSymbolName
public void setColumnHeaderSymbolName(java.lang.String newColumnHeaderSymbolName)
Sets the symbol name for theSARRAYcolumn header data.Please note:
The data is presented transposed. This is for convenience, because often names are stored as column vectors in the symbol table. This behaviour does not occur if the data is explicitely set.- Parameters:
newColumnHeaderSymbolName- the symbol identifier- Throws:
java.lang.IllegalArgumentException- if name is not valid
-
setSymbolScope
public void setSymbolScope(Scope newSymbolScope)
Sets the scope for the symbols used for row and column header.- Parameters:
newSymbolScope-- Throws:
java.lang.IllegalArgumentException-if (newSymbolScope == null)
-
setMaximumVisibleColumns
public void setMaximumVisibleColumns(int newMaximumVisibleColumns)
Sets the maximum number of visible cols that this scrollpane shows. If there are more cols, a horizontal scrollbar will appear and the scrollpane will not grow further. This sets the maximum horizontal space for this component.- Parameters:
newMaximumVisibleColumns- int
-
setMaximumVisibleRows
public void setMaximumVisibleRows(int newMaximumVisibleRows)
Sets the maximum number of visible rows that this scrollpane shows. If there are more rows, a vertical scrollbar will appear and the scrollpane will not grow further. This sets the maximum vertical space for this component.- Parameters:
newMaximumVisibleRows- int
-
setMinimumVisibleColumns
public void setMinimumVisibleColumns(int newMinimumVisibleColumns)
Sets the minimum number of visible cols that this scrollpane shows without scrolling. This property defines, how much horizontal space is reserved for the component, even if there are fewer cols.- Parameters:
newMinimumVisibleColumns- int
-
setMinimumVisibleRows
public void setMinimumVisibleRows(int newMinimumVisibleRows)
Sets the minimum number of visible rows that this scrollpane shows without scrolling. This property defines, how much vertical space is reserved for the component, even if there are fewer rows.- Parameters:
newMinimumVisibleRows- int
-
setRowHeaderAlignment
public void setRowHeaderAlignment(int newRowHeaderAlignment)
Sets the row header alignment, the default isJLabel.RIGHT. This method has no effect of the row header cell renderer is not of typeJSCCellRendererTypes.- Parameters:
newRowHeaderAlignment- JLabel.LEFT, JLabel.RIGHT or JLabel.CENTER- Throws:
java.lang.IllegalArgumentException- if argument is not valid
-
setRowHeaderCellRenderer
public void setRowHeaderCellRenderer(javax.swing.table.TableCellRenderer newRowHeaderCellRenderer)
Sets a new cell renderer for the row header.- Parameters:
newRowHeaderCellRenderer-
-
setRowHeaderData
public void setRowHeaderData(JSCSArray newRowHeaderData)
Sets the data object used for the row header.- Parameters:
newRowHeaderData- row data
-
setRowHeaderSymbolName
public void setRowHeaderSymbolName(java.lang.String newRowHeaderSymbolName)
Sets the symbol name for theSARRAYrow header data.- Parameters:
newRowHeaderSymbolName- symbol identifier- Throws:
java.lang.IllegalArgumentException- if name is not valid
-
setViewportView
public void setViewportView(java.awt.Component view)
Overwrites supermethod to handle data table components specially.- Overrides:
setViewportViewin classjavax.swing.JScrollPane- Parameters:
view- the viewport component
-
getSymbolTable
public SymbolTable getSymbolTable()
Gets the symbol table that has been set for row and column header.- Returns:
- symbol table
-
setSymbolTable
public void setSymbolTable(SymbolTable table)
Sets the symbol table used for row and column header data. Use this method to set an explicit table instead of using the scope hierarchy.- Parameters:
table- the symbol table for the header data
-
-
DMelt 3.0 © DataMelt by jWork.ORG