Ontimize 5.2072EN

com.ontimize.gui.table
Class EJTable

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JTable
                  extended bycom.ontimize.gui.table.EJTable
All Implemented Interfaces:
javax.accessibility.Accessible, javax.swing.event.CellEditorListener, java.util.EventListener, Freeable, java.awt.image.ImageObserver, javax.swing.event.ListSelectionListener, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener

public class EJTable
extends javax.swing.JTable
implements Freeable

This class is the JTable inside the Table.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JTable
javax.swing.JTable.AccessibleJTable
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  boolean fitRowsHeight
           
protected  GroupCellRenderer groupCellRenderer
           
protected  Table ontimizeTable
           
protected  boolean rightDirection
           
protected  boolean rowHeightSet
           
protected  ValueByGroupRenderer valueByGroupRenderer
           
 
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, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
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
EJTable(Table oTable, javax.swing.table.TableModel tableModel, java.util.Vector visibleColumns)
          Creates a EJTable with the default visible columns.
 
Method Summary
 void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
           
 boolean editCellAt(int row, int column, java.util.EventObject eventObject)
           
 void editingCanceled(javax.swing.event.ChangeEvent changeEvent)
          Method called when the table edition is cancel.
 void editingStopped(javax.swing.event.ChangeEvent changeEvent)
          Method called when the table edition stops.
protected  void finalize()
           
protected  void fitRowHeight()
          Adjusts the height of all rows to the contents inside them.
 void free()
          Makes the object to release the resources.
 javax.swing.table.TableCellEditor getCellEditor(int row, int column)
           
 javax.swing.table.TableCellRenderer getCellRenderer(int row, int column)
           
 int getColumnIndex(java.lang.String columnName)
          Returns the column view index
 javax.swing.table.TableCellEditor getDefaultEditor(java.lang.Class type)
          Returns the editor to be used when no editor has been set in a TableColumn.
protected  javax.swing.table.TableCellRenderer getGroupCellRenderer()
          Provides a reference to the GroupCellRenderer for this table.
protected  int getNextVisibleColumn(int columnIndexView, boolean right)
          Returns the index of the next visible column.
 javax.swing.table.TableCellRenderer getNoGroupedCellRenderer(int rowIndex, int columnIndex)
          Returns the CellRenderer for the specified cell, when the cell is not grouped.
protected  TipScroll getTextTip()
           
protected  javax.swing.table.TableCellRenderer getValueByGroupRenderer()
          Provides a reference to the ValueByGroupRenderer for this table.
 boolean isRightDirection()
           
protected  boolean processKeyBinding(javax.swing.KeyStroke keyStroke, java.awt.event.KeyEvent keyEvent, int condition, boolean pressed)
          Additional keybindings registered for component.
protected  void processMouseEvent(java.awt.event.MouseEvent e)
           
 void repaint(java.awt.Rectangle r)
           
protected  void resizeAndRepaint()
           
 void selectFirstVisibleColumn(int rowIndex)
           
 void setFitRowsHeight(boolean autofit)
          Sets the table in 'autofit' mode, which implies that the rows will adapt their height to the contents inside them.
 void setModel(javax.swing.table.TableModel tableModel)
          Sets a new TableModel and liberates the memory occupied by the previous one.
 void setRightDirection(boolean right)
           
 void setRowHeight(int row, int height)
           
 void setValueAt(java.lang.Object aValue, int row, int column)
           
 void tableChanged(javax.swing.event.TableModelEvent e)
           
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, sizeColumnsToFit, sizeColumnsToFit, unconfigureEnclosingScrollPane, updateUI, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

groupCellRenderer

protected GroupCellRenderer groupCellRenderer

valueByGroupRenderer

protected ValueByGroupRenderer valueByGroupRenderer

ontimizeTable

protected Table ontimizeTable

rightDirection

protected boolean rightDirection

rowHeightSet

protected boolean rowHeightSet

fitRowsHeight

protected boolean fitRowsHeight
Constructor Detail

EJTable

public EJTable(Table oTable,
               javax.swing.table.TableModel tableModel,
               java.util.Vector visibleColumns)
Creates a EJTable with the default visible columns. The table, to hide the non visible columns, reduces the size of those to 0, so they remain in the model but with no visibility.

Parameters:
tableModel - the table model inside the JTable
visibleColumns - the columns that will be visible by default
Method Detail

isRightDirection

public boolean isRightDirection()

setRightDirection

public void setRightDirection(boolean right)

free

public void free()
          throws java.lang.Exception
Description copied from interface: Freeable
Makes the object to release the resources.

Specified by:
free in interface Freeable
Throws:
java.lang.Exception

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int row,
                       int column)

repaint

public void repaint(java.awt.Rectangle r)

setRowHeight

public void setRowHeight(int row,
                         int height)

resizeAndRepaint

protected void resizeAndRepaint()

setModel

public void setModel(javax.swing.table.TableModel tableModel)
Sets a new TableModel and liberates the memory occupied by the previous one.


selectFirstVisibleColumn

public void selectFirstVisibleColumn(int rowIndex)

changeSelection

public void changeSelection(int rowIndex,
                            int columnIndex,
                            boolean toggle,
                            boolean extend)

getDefaultEditor

public javax.swing.table.TableCellEditor getDefaultEditor(java.lang.Class type)
Returns the editor to be used when no editor has been set in a TableColumn. In this case, the classes that will be the default editors are

class type default renderer class
java.lang.Double com.ontimize.gui.table.RealCellEditor
java.lang.Float com.ontimize.gui.table.RealCellEditor
java.lang.Integer com.ontimize.gui.table.IntegerCellEditor
java.lang.Long com.ontimize.gui.table.IntegerCellEditor
java.lang.Number com.ontimize.gui.table.IntegerCellEditor
java.util.Date com.ontimize.gui.table.DateCellEditor
java.sql.Date com.ontimize.gui.table.DateCellEditor
java.sql.Timestamp com.ontimize.gui.table.DateCellEditor
java.lang.Boolean com.ontimize.gui.table.BooleanCellEditor
default com.ontimize.gui.table.StringCellEditor


getColumnIndex

public int getColumnIndex(java.lang.String columnName)
Returns the column view index

Parameters:
columnName - the column name
Returns:
the column index in the view; -1 in case the column is not found

editingStopped

public void editingStopped(javax.swing.event.ChangeEvent changeEvent)
Method called when the table edition stops. Notifies the table by calling the table method Table.fireEditingWillStop(java.lang.Object, java.lang.Object, int, int)

Specified by:
editingStopped in interface javax.swing.event.CellEditorListener

editingCanceled

public void editingCanceled(javax.swing.event.ChangeEvent changeEvent)
Method called when the table edition is cancel. Notifies the table by calling the table method Table.fireEditingCancelled(int, int).

Specified by:
editingCanceled in interface javax.swing.event.CellEditorListener

getCellEditor

public javax.swing.table.TableCellEditor getCellEditor(int row,
                                                       int column)

editCellAt

public boolean editCellAt(int row,
                          int column,
                          java.util.EventObject eventObject)

getGroupCellRenderer

protected javax.swing.table.TableCellRenderer getGroupCellRenderer()
Provides a reference to the GroupCellRenderer for this table. If no cell renderer set, creates a new instance for the table.

Returns:
a reference to the groupCellRenderer

getValueByGroupRenderer

protected javax.swing.table.TableCellRenderer getValueByGroupRenderer()
Provides a reference to the ValueByGroupRenderer for this table. If no cell renderer set, creates a new instance for the table.

Returns:
a reference to the valueByGroupRenderer

getCellRenderer

public javax.swing.table.TableCellRenderer getCellRenderer(int row,
                                                           int column)

getNoGroupedCellRenderer

public javax.swing.table.TableCellRenderer getNoGroupedCellRenderer(int rowIndex,
                                                                    int columnIndex)
Returns the CellRenderer for the specified cell, when the cell is not grouped.

Parameters:
rowIndex -
columnIndex -
Returns:
the CellRenderer set to the specified cell

getNextVisibleColumn

protected int getNextVisibleColumn(int columnIndexView,
                                   boolean right)
Returns the index of the next visible column.

Parameters:
columnIndexView -
right - if true, the result will be the column placed at the right place in the table; if it is false, the columns placed at the left side will be chosen
Returns:

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)

processKeyBinding

protected boolean processKeyBinding(javax.swing.KeyStroke keyStroke,
                                    java.awt.event.KeyEvent keyEvent,
                                    int condition,
                                    boolean pressed)
Additional keybindings registered for component.
Key binding Action
VK_LEFT while cell is editing Move back in cell content
VK_DOWN while cell is editing Stops cell edition
VK_RIGHT while cell is editing Move forward in cell content
VK_RIGHT while cell is editing Stops cell edition
VK_TAB while cell is editing Stops cell edition and moves focus to the next right cell
VK_TAB + SHIFT while cell is editing Stops cell edition and moves focus to the next left cell
VK_ESCAPE while cell is editing Stops cell edition and moves focus to the next cell
VK_DELETE while cell is editing Deletes contents in cell
VK_ENTER while cell is editing Stops cell edition
VK_ADD with cell selected Open detail form whether detail form is enabled


setFitRowsHeight

public void setFitRowsHeight(boolean autofit)
Sets the table in 'autofit' mode, which implies that the rows will adapt their height to the contents inside them.

Parameters:
autofit -

tableChanged

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

fitRowHeight

protected void fitRowHeight()
Adjusts the height of all rows to the contents inside them.


getTextTip

protected TipScroll getTextTip()

Ontimize