fr.esrf.tangoatk.widget.util
Class JTableRow

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 fr.esrf.tangoatk.widget.util.JTableRow
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
Direct Known Subclasses:
StringImageTableViewer

public class JTableRow
extends javax.swing.JPanel
implements java.awt.event.ActionListener, java.awt.event.MouseListener

A class to handle a 2 dimension Table with fixed row name and column name, also supports multipage printing.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.lang.String[] colName
           
protected  javax.swing.JMenuItem copyMenuItem
           
protected  javax.swing.JPanel cornerPanel
           
protected  java.io.File currentFile
           
protected  fr.esrf.tangoatk.widget.util.TableRowModel dm
           
protected  javax.swing.table.TableModel dmr
           
protected  boolean editable
           
protected  int hT
           
protected  java.awt.Point menuLocation
           
protected static javax.swing.JLabel noDataLabel
           
static int PRINT_BIG
           
static int PRINT_MEDIUM
           
static int PRINT_SMALL
           
protected  javax.swing.JMenuItem print1MenuItem
           
protected  javax.swing.JMenuItem print2MenuItem
           
protected  javax.swing.JMenuItem print3MenuItem
           
protected  java.lang.Object[][] rowData
           
protected  javax.swing.JPanel rowPanel
           
protected  javax.swing.JTable rowTable
           
protected  javax.swing.JMenuItem saveMenuItem
           
protected  javax.swing.JMenuItem selectAllMenuItem
           
protected  javax.swing.JMenuItem selectColumnMenuItem
           
protected  javax.swing.JMenuItem selectNoneMenuItem
           
protected  javax.swing.JMenuItem selectRowMenuItem
           
protected  javax.swing.JPopupMenu tableMenu
           
protected  javax.swing.JScrollPane tableView
           
protected  java.lang.Object[][] theData
           
protected  java.awt.Font theFont
           
protected  javax.swing.JTable theTable
           
protected  int wT
           
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JTableRow()
          Construction
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void adjustColumnSize()
          Adjust column size according to data.
 void adjustSize()
          Adjust the ScrollPane preferredSize according to the table size.
 void clearData()
          Clear the table
protected  void createTable()
           
 java.awt.Font getFont()
           
 java.lang.Object getObjectAt(int row, int column)
          Returns the cells at the specified pos or null if the table has no data.
 boolean isEditable()
          Returns true if this table is editable
static void main(java.lang.String[] args)
          Test function.
protected  java.lang.String makeDataString()
           
protected  java.lang.String makeTabbedString()
           
protected  int[] measureColumns(java.awt.Font f)
           
 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)
           
protected  void placeComponent()
           
 void printTable(int printSize)
          Display the print dialog and sends the table to the printer.
 void saveDataFile()
           
 void setData(java.lang.Object[][] data, int startLabelX, int startLabelY)
          Sets the data.
 void setData(java.lang.Object[][] data, java.lang.String[] columnNames)
          Sets the data (No row label).
 void setEditable(boolean b)
          Sets this table editable.
 void setFont(java.awt.Font f)
           
protected  void updateTables(int nhT, int nwT)
           
protected  void updateViewPortView()
           
 
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, 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, 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, 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, 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, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, 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

PRINT_BIG

public static final int PRINT_BIG
See Also:
Constant Field Values

PRINT_MEDIUM

public static final int PRINT_MEDIUM
See Also:
Constant Field Values

PRINT_SMALL

public static final int PRINT_SMALL
See Also:
Constant Field Values

wT

protected int wT

hT

protected int hT

editable

protected boolean editable

theFont

protected java.awt.Font theFont

currentFile

protected java.io.File currentFile

tableView

protected javax.swing.JScrollPane tableView

theTable

protected javax.swing.JTable theTable

dm

protected fr.esrf.tangoatk.widget.util.TableRowModel dm

theData

protected java.lang.Object[][] theData

colName

protected java.lang.String[] colName

rowPanel

protected javax.swing.JPanel rowPanel

cornerPanel

protected javax.swing.JPanel cornerPanel

rowTable

protected javax.swing.JTable rowTable

dmr

protected javax.swing.table.TableModel dmr

rowData

protected java.lang.Object[][] rowData

menuLocation

protected java.awt.Point menuLocation

tableMenu

protected javax.swing.JPopupMenu tableMenu

selectAllMenuItem

protected javax.swing.JMenuItem selectAllMenuItem

selectNoneMenuItem

protected javax.swing.JMenuItem selectNoneMenuItem

selectColumnMenuItem

protected javax.swing.JMenuItem selectColumnMenuItem

selectRowMenuItem

protected javax.swing.JMenuItem selectRowMenuItem

copyMenuItem

protected javax.swing.JMenuItem copyMenuItem

saveMenuItem

protected javax.swing.JMenuItem saveMenuItem

print1MenuItem

protected javax.swing.JMenuItem print1MenuItem

print2MenuItem

protected javax.swing.JMenuItem print2MenuItem

print3MenuItem

protected javax.swing.JMenuItem print3MenuItem

noDataLabel

protected static final javax.swing.JLabel noDataLabel
Constructor Detail

JTableRow

public JTableRow()
Construction

Method Detail

setEditable

public void setEditable(boolean b)
Sets this table editable.

Parameters:
b - Editable flag

isEditable

public boolean isEditable()
Returns true if this table is editable


setData

public void setData(java.lang.Object[][] data,
                    int startLabelX,
                    int startLabelY)
Sets the data.

Parameters:
data - Handle to data array.
startLabelX - Horizontal column labeling starting index
startLabelY - Vertical column labeling starting index

setData

public void setData(java.lang.Object[][] data,
                    java.lang.String[] columnNames)
Sets the data (No row label).

Parameters:
data - Handle to data array.
columnNames - Column name

updateTables

protected void updateTables(int nhT,
                            int nwT)

getObjectAt

public java.lang.Object getObjectAt(int row,
                                    int column)
Returns the cells at the specified pos or null if the table has no data.

Parameters:
row - Row index
column - Column index

clearData

public void clearData()
Clear the table


setFont

public void setFont(java.awt.Font f)
Overrides:
setFont in class javax.swing.JComponent

getFont

public java.awt.Font getFont()
Specified by:
getFont in interface java.awt.MenuContainer
Overrides:
getFont in class java.awt.Component

adjustSize

public void adjustSize()
Adjust the ScrollPane preferredSize according to the table size.

See Also:
adjustColumnSize()

adjustColumnSize

public void adjustColumnSize()
Adjust column size according to data. Should be called before adjustSize and after setData.

See Also:
adjustSize()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

saveDataFile

public void saveDataFile()

makeDataString

protected java.lang.String makeDataString()

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked 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

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

createTable

protected void createTable()

updateViewPortView

protected void updateViewPortView()

placeComponent

protected void placeComponent()

makeTabbedString

protected java.lang.String makeTabbedString()

measureColumns

protected int[] measureColumns(java.awt.Font f)

printTable

public void printTable(int printSize)
Display the print dialog and sends the table to the printer.

Parameters:
printSize - Font size for printing
See Also:
PRINT_BIG, PRINT_MEDIUM, PRINT_SMALL

main

public static void main(java.lang.String[] args)
Test function.