com.sibvisions.rad.ui.swing.impl.control
Class SwingTable

java.lang.Object
  extended by com.sibvisions.rad.ui.awt.impl.AwtResource<C>
      extended by com.sibvisions.rad.ui.awt.impl.AwtComponent<C>
          extended by com.sibvisions.rad.ui.awt.impl.AwtContainer<C>
              extended by com.sibvisions.rad.ui.swing.impl.SwingComponent<C>
                  extended by com.sibvisions.rad.ui.swing.impl.SwingScrollComponent<JVxTable,JTable>
                      extended by com.sibvisions.rad.ui.swing.impl.control.SwingTable
All Implemented Interfaces:
ICellFormatter, ComponentListener, FocusListener, KeyListener, MouseListener, EventListener, IControl, ITableControl, ITranslatable, ICellFormatable, INavigationControl, ITable, IAlignmentConstants, IComponent, IContainer, IResource, INamedObject, ITranslator

public class SwingTable
extends SwingScrollComponent<JVxTable,JTable>
implements ITable, ICellFormatter

The SwingTable is the ITable implementation for swing.

See Also:
JTable

Field Summary
 
Fields inherited from class com.sibvisions.rad.ui.swing.impl.SwingScrollComponent
component
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
bComponentListener, bFocusListener, bKeyListener, bMouseListener, eventComponentMoved, eventComponentResized, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, eventSource, factory, parent
 
Fields inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
resource
 
Fields inherited from interface javax.rad.ui.control.INavigationControl
NAVIGATION_CELL_AND_FOCUS, NAVIGATION_CELL_AND_ROW_AND_FOCUS, NAVIGATION_NONE, NAVIGATION_ROW_AND_FOCUS
 
Fields inherited from interface javax.rad.ui.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Constructor Summary
SwingTable()
          Creates a new instance of SwingTable.
 
Method Summary
 void cancelEditing()
          Informs the GUI control, that the last edit should be canceled(restored) the correct value is in the DataBook.
 CellFormat getCellFormat(IDataBook pDataBook, IDataPage pDataPage, IDataRow pDataRow, String pColumnName, int pRow, int pColumn)
          Gets the format for the given cell.
 ICellFormatter getCellFormatter()
          Gets the cell formatter.
 ColumnView getColumnView()
          Returns the ColumnView displayed by this control.
 IDataBook getDataBook()
          Returns the DataBook displayed by this control.
 int getEnterNavigationMode()
          Gets the navigation mode for the ENTER key.
 int getMaxRowHeight()
          Gets the max row height for automatic calculation.
 int getMinRowHeight()
          Gets the min row height for automatic calculation.
 int getRowHeight()
          Gets the row height.
 int getTabNavigationMode()
          Gets the navigation mode for the TAB key.
 TranslationMap getTranslation()
          Gets the translation for this table.
 boolean isAutoResize()
          Gets true, if the ITable is in auto resize mode.
 boolean isEditable()
          Gets if editable or not.
 boolean isMouseEventOnSelectedCell()
          True, if the mouse event occured on current selected cell.
 boolean isShowFocusRect()
          Gets if showing the focus rect or not.
 boolean isShowHorizontalLines()
          Gets if showing the vertical lines or not.
 boolean isShowSelection()
          Gets if showing the selection or not.
 boolean isShowVerticalLines()
          Gets if showing the vertical lines or not.
 boolean isSortOnHeaderEnabled()
          Gets true, if it is possible sorting the data by clicking on the header.
 boolean isTableHeaderVisible()
          Gets the visibility of the table header.
 boolean isTranslationEnabled()
          Gets whether the translation is en- or disabled.
 void notifyRepaint()
          The control need to check if the part is visible and then repaint the part.
 void saveEditing()
          Informs the GUI control, that the last edit should be set into the IDataBook or IDataRow.
 void setAutoResize(boolean pAutoResize)
          Sets true, if the ITable is in auto resize mode.
 void setCellFormatter(ICellFormatter pCellFormatter)
          Sets the cell formatter.
 void setColumnView(ColumnView pColumnView)
          Sets the ColumnView displayed by this control.
 void setDataBook(IDataBook pDataBook)
          Sets the DataBook displayed by this control.
 void setEditable(boolean pEditable)
          Sets if editable or not.
 void setEnterNavigationMode(int pNavigationMode)
          Sets the navigation mode for the ENTER key.
 void setMaxRowHeight(int pMaxRowHeight)
          Sets the max row height for automatic calculation.
 void setMinRowHeight(int pMinRowHeight)
          Sets the min row height for automatic calculation.
 void setRowHeight(int pRowHeight)
          Sets the row height.
 void setShowFocusRect(boolean pShowFocusRect)
          Sets if showing the focus rect or not.
 void setShowHorizontalLines(boolean pShowHorizontalLines)
          Sets if showing the vertical lines or not.
 void setShowSelection(boolean pShowSelection)
          Sets if showing the selection or not.
 void setShowVerticalLines(boolean pShowVerticalLines)
          Sets if showing the vertical lines or not.
 void setSortOnHeaderEnabled(boolean pSortOnHeaderEnabled)
          Set true, if it should possible sorting the data by clicking on the header.
 void setTableHeaderVisible(boolean pTableHeaderVisible)
          Sets the visibility of the table header.
 void setTabNavigationMode(int pNavigationMode)
          Sets the navigation mode for the TAB key.
 void setTranslation(TranslationMap pTranslation)
          Sets the translation for this table.
 void setTranslationEnabled(boolean pEnabled)
          Sets the translation en- or disabled.
 void startEditing()
          Informs the GUI control, that the editor should be opened.
 String translate(String pText)
          Method to translate a given text.
 
Methods inherited from class com.sibvisions.rad.ui.swing.impl.SwingScrollComponent
addFocusListener, addKeyListener, addMouseListener, getBackground, getComponent, getCursor, getFont, getForeground, getName, getToolTipText, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setForeground, setName, setTabIndex, setToolTipText
 
Methods inherited from class com.sibvisions.rad.ui.swing.impl.SwingComponent
capture
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtContainer
add, add, add, add, addIntern, checkAdd, getComponent, getComponentCount, getLayout, indexOf, remove, remove, removeAll, removeIntern, setLayout, setLayoutIntern
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtComponent
addComponentListener, componentHidden, componentMoved, componentResized, componentShown, createImage, createMouseEvent, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, focusGained, focusLost, getBounds, getEventSource, getFactory, getHorizontalAlignment, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getSize, getStyle, getTabIndex, getVerticalAlignment, invalidateLayout, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, setBounds, setEventSource, setFactory, setHorizontalAlignment, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setParent, setPreferredSize, setSize, setStyle, setVerticalAlignment, setVisible, validate
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
equals, getResource, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.ui.IComponent
capture, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, getSize, getStyle, getTabIndex, getToolTipText, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, requestFocus, setBackground, setBounds, setCursor, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setName, setParent, setPreferredSize, setSize, setStyle, setTabIndex, setToolTipText, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 

Constructor Detail

SwingTable

public SwingTable()
Creates a new instance of SwingTable.

Method Detail

getDataBook

public IDataBook getDataBook()
Returns the DataBook displayed by this control.

Specified by:
getDataBook in interface ITableControl
Returns:
the DataBook.
See Also:
ITableControl.setDataBook(javax.rad.model.IDataBook)

setDataBook

public void setDataBook(IDataBook pDataBook)
Sets the DataBook displayed by this control.

Specified by:
setDataBook in interface ITableControl
Parameters:
pDataBook - the DataBook
See Also:
ITableControl.getDataBook()

getColumnView

public ColumnView getColumnView()
Returns the ColumnView displayed by this control. If null is set, the default ColumnView is shown.

Specified by:
getColumnView in interface ITable
Returns:
the ColumnView.
See Also:
ITable.setColumnView(javax.rad.model.ColumnView)

setColumnView

public void setColumnView(ColumnView pColumnView)
Sets the ColumnView displayed by this control. If null is set, the default ColumnView is shown.

Specified by:
setColumnView in interface ITable
Parameters:
pColumnView - the ColumnView
See Also:
ITable.getColumnView()

isAutoResize

public boolean isAutoResize()
Gets true, if the ITable is in auto resize mode.

Specified by:
isAutoResize in interface ITable
Returns:
true, if the ITable is in auto resize mode.

setAutoResize

public void setAutoResize(boolean pAutoResize)
Sets true, if the ITable is in auto resize mode.

Specified by:
setAutoResize in interface ITable
Parameters:
pAutoResize - true, if the ITable is in auto resize mode.

getMaxRowHeight

public int getMaxRowHeight()
Gets the max row height for automatic calculation.

Specified by:
getMaxRowHeight in interface ITable
Returns:
the max row height for automatic calculation.

getMinRowHeight

public int getMinRowHeight()
Gets the min row height for automatic calculation.

Specified by:
getMinRowHeight in interface ITable
Returns:
the min row height for automatic calculation.

getRowHeight

public int getRowHeight()
Gets the row height. A negativ row height means automatic calculation of row height between min and max row height. A positiv row height should be used as is.

Specified by:
getRowHeight in interface ITable
Returns:
the row height.

setMaxRowHeight

public void setMaxRowHeight(int pMaxRowHeight)
Sets the max row height for automatic calculation.

Specified by:
setMaxRowHeight in interface ITable
Parameters:
pMaxRowHeight - the max row height for automatic calculation.

setMinRowHeight

public void setMinRowHeight(int pMinRowHeight)
Sets the min row height for automatic calculation.

Specified by:
setMinRowHeight in interface ITable
Parameters:
pMinRowHeight - the min row height for automatic calculation.

setRowHeight

public void setRowHeight(int pRowHeight)
Sets the row height. A negativ row height means automatic calculation of row height between min and max row height. A positiv row height should be used as is.

Specified by:
setRowHeight in interface ITable
Parameters:
pRowHeight - the row height.

isTableHeaderVisible

public boolean isTableHeaderVisible()
Gets the visibility of the table header.

Specified by:
isTableHeaderVisible in interface ITable
Returns:
the visibility of the table header.

setTableHeaderVisible

public void setTableHeaderVisible(boolean pTableHeaderVisible)
Sets the visibility of the table header.

Specified by:
setTableHeaderVisible in interface ITable
Parameters:
pTableHeaderVisible - the visibility of the table header.

isSortOnHeaderEnabled

public boolean isSortOnHeaderEnabled()
Gets true, if it is possible sorting the data by clicking on the header.

Specified by:
isSortOnHeaderEnabled in interface ITable
Returns:
true, if it is possible sorting the data by clicking on the header.

setSortOnHeaderEnabled

public void setSortOnHeaderEnabled(boolean pSortOnHeaderEnabled)
Set true, if it should possible sorting the data by clicking on the header.

Specified by:
setSortOnHeaderEnabled in interface ITable
Parameters:
pSortOnHeaderEnabled - true, if it is possible sorting the data by clicking on the header.

getEnterNavigationMode

public int getEnterNavigationMode()
Gets the navigation mode for the ENTER key.

Specified by:
getEnterNavigationMode in interface INavigationControl
Returns:
the navigation mode for the ENTER key.
See Also:
INavigationControl.NAVIGATION_NONE, INavigationControl.NAVIGATION_CELL_AND_FOCUS, INavigationControl.NAVIGATION_CELL_AND_ROW_AND_FOCUS, INavigationControl.NAVIGATION_ROW_AND_FOCUS

getTabNavigationMode

public int getTabNavigationMode()
Gets the navigation mode for the TAB key.

Specified by:
getTabNavigationMode in interface INavigationControl
Returns:
the navigation mode for the TAB key.
See Also:
INavigationControl.NAVIGATION_NONE, INavigationControl.NAVIGATION_CELL_AND_FOCUS, INavigationControl.NAVIGATION_CELL_AND_ROW_AND_FOCUS, INavigationControl.NAVIGATION_ROW_AND_FOCUS

setEnterNavigationMode

public void setEnterNavigationMode(int pNavigationMode)
Sets the navigation mode for the ENTER key.

Specified by:
setEnterNavigationMode in interface INavigationControl
Parameters:
pNavigationMode - the navigation mode for the ENTER key.
See Also:
INavigationControl.NAVIGATION_NONE, INavigationControl.NAVIGATION_CELL_AND_FOCUS, INavigationControl.NAVIGATION_CELL_AND_ROW_AND_FOCUS, INavigationControl.NAVIGATION_ROW_AND_FOCUS

setTabNavigationMode

public void setTabNavigationMode(int pNavigationMode)
Sets the navigation mode for the TAB key.

Specified by:
setTabNavigationMode in interface INavigationControl
Parameters:
pNavigationMode - the navigation mode for the TAB key.
See Also:
INavigationControl.NAVIGATION_NONE, INavigationControl.NAVIGATION_CELL_AND_FOCUS, INavigationControl.NAVIGATION_CELL_AND_ROW_AND_FOCUS, INavigationControl.NAVIGATION_ROW_AND_FOCUS

notifyRepaint

public void notifyRepaint()
The control need to check if the part is visible and then repaint the part. Notify repaint is called on every change. The IControl has to catch the change, and return immediate. The change analysis and display has to be done with invoke later by the control.

Specified by:
notifyRepaint in interface IControl

startEditing

public void startEditing()
Informs the GUI control, that the editor should be opened.

Specified by:
startEditing in interface ITableControl

cancelEditing

public void cancelEditing()
Informs the GUI control, that the last edit should be canceled(restored) the correct value is in the DataBook.

Specified by:
cancelEditing in interface IControl

saveEditing

public void saveEditing()
                 throws ModelException
Informs the GUI control, that the last edit should be set into the IDataBook or IDataRow.

Specified by:
saveEditing in interface IControl
Throws:
ModelException - if the value can not be stored.

setTranslation

public void setTranslation(TranslationMap pTranslation)
Sets the translation for this table.

Specified by:
setTranslation in interface ITranslatable
Specified by:
setTranslation in interface ITable
Parameters:
pTranslation - the translation mapping

getTranslation

public TranslationMap getTranslation()
Gets the translation for this table.

Specified by:
getTranslation in interface ITranslatable
Specified by:
getTranslation in interface ITable
Returns:
the translation mapping

setTranslationEnabled

public void setTranslationEnabled(boolean pEnabled)
Sets the translation en- or disabled.

Specified by:
setTranslationEnabled in interface ITranslatable
Parameters:
pEnabled - true to enable the translation, false to disable

isTranslationEnabled

public boolean isTranslationEnabled()
Gets whether the translation is en- or disabled.

Specified by:
isTranslationEnabled in interface ITranslatable
Returns:
true if translation is performed, false otherwise

translate

public String translate(String pText)
Method to translate a given text.

Specified by:
translate in interface ITranslator
Parameters:
pText - the text to translate.
Returns:
the translated text.

getCellFormatter

public ICellFormatter getCellFormatter()
Gets the cell formatter.

Specified by:
getCellFormatter in interface ICellFormatable
Returns:
the cell formatter.

setCellFormatter

public void setCellFormatter(ICellFormatter pCellFormatter)
Sets the cell formatter.

Specified by:
setCellFormatter in interface ICellFormatable
Parameters:
pCellFormatter - the cell formatter.

getCellFormat

public CellFormat getCellFormat(IDataBook pDataBook,
                                IDataPage pDataPage,
                                IDataRow pDataRow,
                                String pColumnName,
                                int pRow,
                                int pColumn)
Gets the format for the given cell.

Specified by:
getCellFormat in interface ICellFormatter
Parameters:
pDataBook - the DataBook
pDataPage - the DataPage
pDataRow - the DataRow
pColumnName - the column name
pRow - the Row number
pColumn - the Column number
Returns:
the format for the given cell.

isEditable

public boolean isEditable()
Gets if editable or not.

Specified by:
isEditable in interface ITable
Returns:
if editable or not.

setEditable

public void setEditable(boolean pEditable)
Sets if editable or not.

Specified by:
setEditable in interface ITable
Parameters:
pEditable - if editable or not.

isShowSelection

public boolean isShowSelection()
Gets if showing the selection or not.

Specified by:
isShowSelection in interface ITable
Returns:
showing the selection or not.

setShowSelection

public void setShowSelection(boolean pShowSelection)
Sets if showing the selection or not.

Specified by:
setShowSelection in interface ITable
Parameters:
pShowSelection - showing the selection or not.

isShowFocusRect

public boolean isShowFocusRect()
Gets if showing the focus rect or not.

Specified by:
isShowFocusRect in interface ITable
Returns:
showing the focus rect or not.

setShowFocusRect

public void setShowFocusRect(boolean pShowFocusRect)
Sets if showing the focus rect or not.

Specified by:
setShowFocusRect in interface ITable
Parameters:
pShowFocusRect - showing the focus rect or not.

isShowVerticalLines

public boolean isShowVerticalLines()
Gets if showing the vertical lines or not.

Specified by:
isShowVerticalLines in interface ITable
Returns:
showing the vertical lines or not.

setShowVerticalLines

public void setShowVerticalLines(boolean pShowVerticalLines)
Sets if showing the vertical lines or not.

Specified by:
setShowVerticalLines in interface ITable
Parameters:
pShowVerticalLines - showing the vertical lines or not.

isShowHorizontalLines

public boolean isShowHorizontalLines()
Gets if showing the vertical lines or not.

Specified by:
isShowHorizontalLines in interface ITable
Returns:
showing the vertical lines or not.

setShowHorizontalLines

public void setShowHorizontalLines(boolean pShowHorizontalLines)
Sets if showing the vertical lines or not.

Specified by:
setShowHorizontalLines in interface ITable
Parameters:
pShowHorizontalLines - showing the vertical lines or not.

isMouseEventOnSelectedCell

public boolean isMouseEventOnSelectedCell()
True, if the mouse event occured on current selected cell.

Specified by:
isMouseEventOnSelectedCell in interface ITable
Returns:
True, if the mouse event occured on current selected cell.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.