com.jaxfront.swing.ui.beans
Class RowHeadedTable

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JScrollPane
                  extended by com.jaxfront.swing.ui.beans.RowHeadedTable
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.ScrollPaneConstants

public class RowHeadedTable
extends javax.swing.JScrollPane
implements javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, java.awt.event.ActionListener, java.awt.event.MouseListener

The RowHeadedTable can be seen as an extension to the JTable. A JTable provides only column headers but no row labels. This lack of functionality will be equalized by this table. The user can flip the tablelayout by runtime, that means the rows becomes to columns and the columns become to rows. To provide this kind of behaviour the RowHeadedTable needs the RowHeaderTable as inner Component

Version:
1.60
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RowHeadedTable(FlipOrientationTableModel tm, AbstractListTypeView view, int noOfDisplayableRows)
          Create a row headed table from the flipped orientation table model
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Tracks an action event.
 void columnAdded(javax.swing.event.TableColumnModelEvent e)
          Tells listeners that a column was added to the model.
 void columnMarginChanged(javax.swing.event.ChangeEvent e)
          Tells listeners that a column was moved due to a margin change.
 void columnMoved(javax.swing.event.TableColumnModelEvent e)
          Implementation of TableColumnListener Method Clears the user selection to avoid unnecessary selection updates, switches the Table headers of the two columns concerned and tells the Type (The com.jaxfront.type.AbstractListType) to swap the 2 elements in its list
 void columnRemoved(javax.swing.event.TableColumnModelEvent e)
          Tells listeners that a column was removed from the model.
 void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
          Tells listeners that the selection model of the TableColumnModel changed.
 JAXJTable getDataTable()
          Returns the data table.
 FlipOrientationTableModel getModel()
          Returns the flip orientation table model.
 int getNoOfDisplayableRows()
           
 javax.swing.ListSelectionModel getSelectionModel()
          Return the appropriate ListSelectionModel: if the tablemodel is flipped, get the COLUMNMODEL'S selection model, else get the normal table's selection model
 boolean isFlipped()
          Needed for enabling/disabling the up/down buttons
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void refresh()
          Initializes the components of the table.
 void release()
          Releases the table model and initializes the variables.
 void scrollToSelection(int rowIndex)
          Scrolls the viewport to the current selected row.
 void setEnabled(boolean enabled)
          Sets the table enabled/disabled.
 boolean showUpDownButtons()
          Shows the up and down buttons of the table.
 void tableChanged(javax.swing.event.TableModelEvent arg0)
           
 
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, setViewportView, 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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, 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, 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, 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, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RowHeadedTable

public RowHeadedTable(FlipOrientationTableModel tm,
                      AbstractListTypeView view,
                      int noOfDisplayableRows)
Create a row headed table from the flipped orientation table model

Parameters:
tm - a FlipOrientationTableModel
view - a AbstractListTypeView
noOfDisplayableRows - no of the rows to display (default is 5)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Tracks an action event.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - an action event that occured
See Also:
ActionListener.actionPerformed(ActionEvent)

columnAdded

public void columnAdded(javax.swing.event.TableColumnModelEvent e)
Tells listeners that a column was added to the model.

Specified by:
columnAdded in interface javax.swing.event.TableColumnModelListener
Parameters:
e - a tableColumnModelEvent that occured
See Also:
TableColumnModelListener.columnAdded(TableColumnModelEvent)

columnMarginChanged

public void columnMarginChanged(javax.swing.event.ChangeEvent e)
Tells listeners that a column was moved due to a margin change.

Specified by:
columnMarginChanged in interface javax.swing.event.TableColumnModelListener
Parameters:
e - a change event that occured
See Also:
TableColumnModelListener.columnMarginChanged(ChangeEvent)

columnMoved

public void columnMoved(javax.swing.event.TableColumnModelEvent e)
Implementation of TableColumnListener Method Clears the user selection to avoid unnecessary selection updates, switches the Table headers of the two columns concerned and tells the Type (The com.jaxfront.type.AbstractListType) to swap the 2 elements in its list

Specified by:
columnMoved in interface javax.swing.event.TableColumnModelListener
Parameters:
e - a table column event that occured
See Also:
TableColumnModelListener.columnMoved(TableColumnModelEvent)

columnRemoved

public void columnRemoved(javax.swing.event.TableColumnModelEvent e)
Tells listeners that a column was removed from the model.

Specified by:
columnRemoved in interface javax.swing.event.TableColumnModelListener
Parameters:
e - a table column model event that occured
See Also:
TableColumnModelListener.columnRemoved(TableColumnModelEvent)

columnSelectionChanged

public void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
Tells listeners that the selection model of the TableColumnModel changed.

Specified by:
columnSelectionChanged in interface javax.swing.event.TableColumnModelListener
Parameters:
e - a list selection event that occured
See Also:
TableColumnModelListener.columnSelectionChanged(ListSelectionEvent)

getDataTable

public JAXJTable getDataTable()
Returns the data table.

Returns:
JTable the data table

getModel

public FlipOrientationTableModel getModel()
Returns the flip orientation table model.

Returns:
FlipOrientationTableModel the flip orientation table model

getSelectionModel

public javax.swing.ListSelectionModel getSelectionModel()
Return the appropriate ListSelectionModel: if the tablemodel is flipped, get the COLUMNMODEL'S selection model, else get the normal table's selection model

Returns:
ListSelectionModel

refresh

public void refresh()
Initializes the components of the table.


isFlipped

public boolean isFlipped()
Needed for enabling/disabling the up/down buttons

Returns:
boolean true, if the table model is flipped, false otherwise

setEnabled

public void setEnabled(boolean enabled)
Sets the table enabled/disabled.

Overrides:
setEnabled in class javax.swing.JComponent
Parameters:
enabled - true, if the table should be enabled
See Also:
Component.setEnabled(boolean)

showUpDownButtons

public boolean showUpDownButtons()
Shows the up and down buttons of the table.

Returns:
boolean true, if the up and down buttons are shown

release

public void release()
Releases the table model and initializes the variables.


scrollToSelection

public void scrollToSelection(int rowIndex)
Scrolls the viewport to the current selected row.

Parameters:
rowIndex - the index of the current selected row

tableChanged

public void tableChanged(javax.swing.event.TableModelEvent arg0)
Specified by:
tableChanged in interface javax.swing.event.TableModelListener

getNoOfDisplayableRows

public int getNoOfDisplayableRows()
Returns:
Returns the _noOfDisplayableRows.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener