LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing.component
Class LyJTableComponent

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTable
                  extended by leon.view.win.swing.component.LyJTableComponent
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.CellEditorListener, javax.swing.event.ListSelectionListener, javax.swing.event.RowSorterListener, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, javax.swing.Scrollable, LyActionListener, LyEventTransmitter, LySelectionListener, LyJCustomizedScrollable

public class LyJTableComponent
extends javax.swing.JTable
implements LySelectionListener, LyActionListener, LyEventTransmitter, LyJCustomizedScrollable

This class implements graphical component that display the data in a table view.

See Also:
LySwingTable, JTable, Serialized Form

Nested Class Summary
 class LyJTableComponent._LyJTableHeader
          Handles table headers.
 
Nested classes/interfaces inherited from class javax.swing.JTable
javax.swing.JTable.DropLocation, javax.swing.JTable.PrintMode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static java.lang.String __VERSION
           
 java.awt.event.MouseListener _mouseListener
          The mouseListener of this table.
static int TIP_MAX_CHARS
          The maximum width of a line in a tooltip.
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS
 
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
LyJTableComponent(java.awt.Image downImage, java.awt.Image upImage, java.awt.event.MouseListener mouseListener, javax.swing.event.ListSelectionListener selectionListener)
          Creates a table object that don't have drag and drop and initializes it.
LyJTableComponent(java.awt.Image downImage, java.awt.Image upImage, java.awt.event.MouseListener mouseListener, javax.swing.event.ListSelectionListener selectionListener, boolean dragNDrop)
          Deprecated.  
 
Method Summary
 void actionPerformed(LyActionEvent e)
          Invoked when an action occurs.
 void addLyJTableMouseListener()
          Registers mouse events for this table and its header.
 void addLyJTableSelectionListener()
          Registers selection events for this table.
 void cacheHeight()
          Automatically computes the heights of rows.
 int computeLevelHeight(int row, java.lang.String level)
          Computes the height for a given row and a given level.
 void createDefaultColumnsFromModel()
           
 void editNextCell(boolean next)
          Edit the next editable cell of this table.
 LyActionTransmitter getActionTransmitter()
          Gets the action transmitter of the current component.
 javax.swing.table.TableCellRenderer getCellRenderer(int row, int column)
           
 java.awt.Dimension getCustomizedScrollablePreferredSize()
          Determines the part of the table that must activate scrollbars apparition.
 javax.swing.table.TableCellEditor getDefaultEditor(java.lang.Class<?> columnClass)
           
 java.awt.event.MouseListener getLyJTableMouseListener()
          Gets the mouse events listener of this table.
 java.awt.Dimension getPreferredScrollableViewportSize()
           
 LySelectionTransmitter getSelectionTransmitter()
          Gets the selection transmitter of the current component.
 java.awt.Dimension getSize()
          Doesn't consider the last cosmetic column in layout computing and ignores the empty rows.
 javax.swing.Icon getSortDownIcon()
          Gets the icon for sort down.
 java.awt.Image getSortDownImage()
          Gets the image for sort down.
 javax.swing.Icon getSortUpIcon()
          Gets the icon for sort up.
 java.awt.Image getSortUpImage()
          Gets the image for sort up.
 LyJTableModel getTableModel()
          Gets this table data model.
 java.lang.String getToolTipText(java.awt.event.MouseEvent e)
           
 boolean hasEditableCells()
          Indicates whether table has at least one editable cell.
 void initialize()
          Initializes this table component.
 boolean isComputeHeight()
          Indicates that height must be computed for each row of the table.
 boolean isEditing()
          Checks that the cell is still in edition.
 void paint(java.awt.Graphics g)
           
 void removeLyJTableMouseListener()
          Unregisters mouse events for this table and its header.
 void removeLyJTableSelectionListener()
          Unregisters selection events for this table.
 void scrollToColumn(int column)
          Scrolls this table to show the column at the specified index.
 void scrollToRow(int row)
          Scrolls this table to show the row at the specified index.
 void selectionPerformed(LySelectionEvent e)
          Implementation of the LySelectionListener interface.
 void setCellRenderer(javax.swing.table.TableCellRenderer cellRenderer)
          Sets the cell renderer of this table.
 void setComputeHeight(boolean compute)
          Specifies that the height must be computed for each row of the table.
 void setDisplayedHeight(int height)
          Sets the displayed height.
 void setDragAndDrop()
          Initialize drag and drop or table component.
 void setEditableCells(boolean hasEditableCells)
          Sets the value of the parameter that indicates if table has at least one editable cell.
 void setHeaderColor(java.awt.Color color)
          Sets the header background color.
 void setHeaderNames(java.lang.String[] names)
          Sets the header identifiers.
 void setMinChars(int chars)
          Set the minimum number of char ro display.
 void setMinHeight(int height)
          Sets the minimum height.
 void setRightMargin(int margin)
          Sets the right margin.
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, isCellEditable, isCellSelected, isColumnSelected, isRowSelected, moveColumn, prepareEditor, prepareRenderer, print, print, print, print, print, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, tableChanged, updateUI, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, 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, 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, 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, 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, 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

__VERSION

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

TIP_MAX_CHARS

public static int TIP_MAX_CHARS
The maximum width of a line in a tooltip.


_mouseListener

public java.awt.event.MouseListener _mouseListener
The mouseListener of this table.

Constructor Detail

LyJTableComponent

public LyJTableComponent(java.awt.Image downImage,
                         java.awt.Image upImage,
                         java.awt.event.MouseListener mouseListener,
                         javax.swing.event.ListSelectionListener selectionListener)
Creates a table object that don't have drag and drop and initializes it.

Parameters:
downImage - the sort down image
upImage - the sort up image
mouseListener - the mouse listener of this table
selectionListener - the selection listener of this table

LyJTableComponent

public LyJTableComponent(java.awt.Image downImage,
                         java.awt.Image upImage,
                         java.awt.event.MouseListener mouseListener,
                         javax.swing.event.ListSelectionListener selectionListener,
                         boolean dragNDrop)
Deprecated. 

Creates a table object with the specified attributes and initializes it.

Parameters:
downImage - the sort down image
upImage - the sort up image
mouseListener - the mouse listener of this table
selectionListener - the selection listener of this table
dragNDrop - Indicates that drag and drop is allowed on this component.
Method Detail

initialize

public void initialize()
Initializes this table component.


setDragAndDrop

public void setDragAndDrop()
Initialize drag and drop or table component.


isEditing

public boolean isEditing()
Checks that the cell is still in edition. Editable status of a cell may change.

Overrides:
isEditing in class javax.swing.JTable
See Also:
JTable.isEditing()

getDefaultEditor

public javax.swing.table.TableCellEditor getDefaultEditor(java.lang.Class<?> columnClass)
Overrides:
getDefaultEditor in class javax.swing.JTable

getSortDownImage

public java.awt.Image getSortDownImage()
Gets the image for sort down.

Returns:
the sort down image

getSortUpImage

public java.awt.Image getSortUpImage()
Gets the image for sort up.

Returns:
the sort up image

getSortDownIcon

public javax.swing.Icon getSortDownIcon()
Gets the icon for sort down.

Returns:
the sort down icon

getSortUpIcon

public javax.swing.Icon getSortUpIcon()
Gets the icon for sort up.

Returns:
the sort up icon

addLyJTableMouseListener

public void addLyJTableMouseListener()
Registers mouse events for this table and its header.

See Also:
removeLyJTableMouseListener()

addLyJTableSelectionListener

public void addLyJTableSelectionListener()
Registers selection events for this table.

See Also:
removeLyJTableSelectionListener()

removeLyJTableMouseListener

public void removeLyJTableMouseListener()
Unregisters mouse events for this table and its header.

See Also:
addLyJTableMouseListener()

removeLyJTableSelectionListener

public void removeLyJTableSelectionListener()
Unregisters selection events for this table.

See Also:
addLyJTableSelectionListener()

getLyJTableMouseListener

public java.awt.event.MouseListener getLyJTableMouseListener()
Gets the mouse events listener of this table.

Returns:
the mouse listener

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable
Overrides:
getPreferredScrollableViewportSize in class javax.swing.JTable

setMinChars

public void setMinChars(int chars)
Set the minimum number of char ro display.

Parameters:
chars - the minimum number of char to display

setRightMargin

public void setRightMargin(int margin)
Sets the right margin.

Parameters:
margin - the new right margin

setMinHeight

public void setMinHeight(int height)
Sets the minimum height.

Parameters:
height - the new minimum height

setDisplayedHeight

public void setDisplayedHeight(int height)
Sets the displayed height.

Parameters:
height - the new displayed height

getSize

public java.awt.Dimension getSize()
Doesn't consider the last cosmetic column in layout computing and ignores the empty rows.

Overrides:
getSize in class java.awt.Component
See Also:
Component.getSize()

getCustomizedScrollablePreferredSize

public java.awt.Dimension getCustomizedScrollablePreferredSize()
Determines the part of the table that must activate scrollbars apparition.

Specified by:
getCustomizedScrollablePreferredSize in interface LyJCustomizedScrollable
Returns:
the size of the data part of the table
See Also:
LyJCustomizedScrollable.getCustomizedScrollablePreferredSize()

getTableModel

public LyJTableModel getTableModel()
Gets this table data model.

Returns:
the data model

createDefaultColumnsFromModel

public void createDefaultColumnsFromModel()
Overrides:
createDefaultColumnsFromModel in class javax.swing.JTable

scrollToRow

public void scrollToRow(int row)
Scrolls this table to show the row at the specified index.

Parameters:
row - the index of the row

scrollToColumn

public void scrollToColumn(int column)
Scrolls this table to show the column at the specified index.

Parameters:
column - the index of the column

getCellRenderer

public javax.swing.table.TableCellRenderer getCellRenderer(int row,
                                                           int column)
Overrides:
getCellRenderer in class javax.swing.JTable

setCellRenderer

public void setCellRenderer(javax.swing.table.TableCellRenderer cellRenderer)
Sets the cell renderer of this table.

Parameters:
cellRenderer - the cell renderer
See Also:
getCellRenderer(int, int)

setHeaderNames

public void setHeaderNames(java.lang.String[] names)
Sets the header identifiers.

Parameters:
names - the array of columns identifiers

hasEditableCells

public boolean hasEditableCells()
Indicates whether table has at least one editable cell.

Returns:
true if table has at least one editable cell, false otherwise.

setEditableCells

public void setEditableCells(boolean hasEditableCells)
Sets the value of the parameter that indicates if table has at least one editable cell.

Parameters:
hasEditableCells - the new parameter status.

editNextCell

public void editNextCell(boolean next)
Edit the next editable cell of this table.

Parameters:
next - indicates if next or previous cell must be edited.

setHeaderColor

public void setHeaderColor(java.awt.Color color)
Sets the header background color.

Parameters:
color - the new background color for the header

actionPerformed

public void actionPerformed(LyActionEvent e)
Description copied from interface: LyActionListener
Invoked when an action occurs. (LyActionListener interface)

Specified by:
actionPerformed in interface LyActionListener

selectionPerformed

public void selectionPerformed(LySelectionEvent e)
Description copied from interface: LySelectionListener
Implementation of the LySelectionListener interface.

Specified by:
selectionPerformed in interface LySelectionListener
Parameters:
e - description of the selection which has occured

getActionTransmitter

public LyActionTransmitter getActionTransmitter()
Description copied from interface: LyEventTransmitter
Gets the action transmitter of the current component.

Specified by:
getActionTransmitter in interface LyEventTransmitter
Returns:
the action transmitter of this component

getSelectionTransmitter

public LySelectionTransmitter getSelectionTransmitter()
Description copied from interface: LyEventTransmitter
Gets the selection transmitter of the current component.

Specified by:
getSelectionTransmitter in interface LyEventTransmitter
Returns:
the selection transmitter of this component

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent e)
Overrides:
getToolTipText in class javax.swing.JTable

setComputeHeight

public void setComputeHeight(boolean compute)
Specifies that the height must be computed for each row of the table.

Parameters:
compute - Indicates that height must be computed for each row of the table.

isComputeHeight

public boolean isComputeHeight()
Indicates that height must be computed for each row of the table.

Returns:
true if height must be computed for each row of the table, false otherwise

cacheHeight

public void cacheHeight()
Automatically computes the heights of rows.


computeLevelHeight

public int computeLevelHeight(int row,
                              java.lang.String level)
Computes the height for a given row and a given level.

Parameters:
row - index of the row to be computed
level - level to be computed
Returns:
the height of the given row and level

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JComponent

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com