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

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<JVxEditor>
                  extended by com.sibvisions.rad.ui.swing.impl.control.SwingEditor
All Implemented Interfaces:
ICellFormatter, java.awt.event.ComponentListener, java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.util.EventListener, IControl, IEditorControl, ITranslatable, ICellFormatable, IEditor, IAlignmentConstants, IComponent, IContainer, IResource, INamedObject, ITranslator

public class SwingEditor
extends SwingComponent<JVxEditor>
implements IEditor, ICellFormatter

The SwingEditor is the IEditor implementation for swing.

See Also:
JVxEditor

Field Summary
 
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.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Constructor Summary
SwingEditor()
          Creates a new instance of SwingEditor.
 
Method Summary
 void cancelEditing()
          Informs the GUI control, that the last edit should be canceled(restored) the correct value is in the DataBook.
 ICellEditor getCellEditor()
          Gets the CellEditor that edits the given column in the given DataRow.
 CellFormat getCellFormat(IDataBook pDataBook, IDataPage pDataPage, IDataRow pDataRow, java.lang.String pColumnName, int pRow, int pColumn)
          Gets the format for the given cell.
 ICellFormatter getCellFormatter()
          Gets the ICellFormatter.
 java.lang.String getColumnName()
          Returns the column name displayed by this control.
 IDataRow getDataRow()
          Returns the DataRow displayed by this control.
 java.lang.String getName()
          Gets the name of the object.
 TranslationMap getTranslation()
          Gets the possible translation mapping.
 boolean isBorderVisible()
          Returns whether the the border of the text field is visible.
 boolean isSavingImmediate()
          Tells whether the CellEditor should save immediate.
 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 setBorderVisible(boolean pVisible)
          Sets the border of the text field visible or invisible.
 void setCellEditor(ICellEditor pCellEditor)
          Sets the CellEditor that edits the given column in the given DataRow.
 void setCellFormatter(ICellFormatter pCellFormatter)
          Sets the ICellFormatter.
 void setColumnName(java.lang.String pColumnName)
          Sets the column name displayed by this control.
 void setDataRow(IDataRow pDataRow)
          Sets the DataRow displayed by this control.
 void setHorizontalAlignment(int pHorizontalAlignment)
          Sets the horizontal alignment.
 void setName(java.lang.String pName)
          Sets the name of the object to the specified string.
 void setSavingImmediate(boolean pSavingImmediate)
          Sets whether the CellEditor should save immediate.
 void setTranslation(TranslationMap pTranslation)
          Sets the possible translations.
 void setTranslationEnabled(boolean pEnabled)
          Sets the translation en- or disabled.
 void setVerticalAlignment(int pVerticalAlignment)
          Sets the vertical alignment.
 java.lang.String translate(java.lang.String pText)
          Method to translate a given text.
 
Methods inherited from class com.sibvisions.rad.ui.swing.impl.SwingComponent
capture, getToolTipText, setBackground, setTabIndex, setToolTipText
 
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, addFocusListener, addKeyListener, addMouseListener, componentHidden, componentMoved, componentResized, componentShown, createImage, createMouseEvent, equals, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, focusGained, focusLost, getBackground, getBounds, getCursor, getEventSource, getFactory, getFont, getForeground, getHorizontalAlignment, getLocation, getLocationRelativeTo, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getSize, getStyle, getTabIndex, getVerticalAlignment, hashCode, invalidateLayout, isBackgroundSet, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isVisible, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, requestFocus, setBounds, setCursor, setEnabled, setEventSource, setFactory, setFocusable, setFont, setForeground, setLocation, setLocationRelativeTo, setMaximumSize, setMinimumSize, setParent, setPreferredSize, setSize, setStyle, setVisible, validate
 
Methods inherited from class com.sibvisions.rad.ui.awt.impl.AwtResource
getResource, 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, 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, setParent, setPreferredSize, setSize, setStyle, setTabIndex, setToolTipText, setVisible
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 
Methods inherited from interface javax.rad.ui.IAlignmentConstants
getHorizontalAlignment, getVerticalAlignment
 

Constructor Detail

SwingEditor

public SwingEditor()
Creates a new instance of SwingEditor.

Method Detail

getDataRow

public IDataRow getDataRow()
Returns the DataRow displayed by this control.

Specified by:
getDataRow in interface IEditorControl
Returns:
the DataRow.
See Also:
IEditorControl.setDataRow(javax.rad.model.IDataRow)

setDataRow

public void setDataRow(IDataRow pDataRow)
                throws ModelException
Sets the DataRow displayed by this control.

Specified by:
setDataRow in interface IEditorControl
Parameters:
pDataRow - the DataRow
Throws:
ModelException - if the column name is invalid
See Also:
IEditorControl.getDataRow(), IEditorControl.setColumnName(String)

getColumnName

public java.lang.String getColumnName()
Returns the column name displayed by this control.

Specified by:
getColumnName in interface IEditorControl
Returns:
the column name.
See Also:
IEditorControl.setColumnName(java.lang.String)

setColumnName

public void setColumnName(java.lang.String pColumnName)
                   throws ModelException
Sets the column name displayed by this control.

Specified by:
setColumnName in interface IEditorControl
Parameters:
pColumnName - the column name.
Throws:
ModelException - if the column name is invalid
See Also:
IEditorControl.getColumnName()

getCellEditor

public ICellEditor getCellEditor()
Gets the CellEditor that edits the given column in the given DataRow. If the CellEditor is null, the editor from the columns DataType is used to edit.

Specified by:
getCellEditor in interface IEditorControl
Specified by:
getCellEditor in interface IEditor
Returns:
the CellEditor.
See Also:
IEditor.setCellEditor(javax.rad.model.ui.ICellEditor)

setCellEditor

public void setCellEditor(ICellEditor pCellEditor)
                   throws ModelException
Sets the CellEditor that edits the given column in the given DataRow. If the CellEditor is null, the editor from the columns DataType is used to edit.

Specified by:
setCellEditor in interface IEditorControl
Specified by:
setCellEditor in interface IEditor
Parameters:
pCellEditor - the CellEditor.
Throws:
ModelException - if the cell editor can not be set
See Also:
IEditor.getCellEditor()

isSavingImmediate

public boolean isSavingImmediate()
Tells whether the CellEditor should save immediate.

Specified by:
isSavingImmediate in interface IEditor
Returns:
whether the CellEditor should save immediate.

setSavingImmediate

public void setSavingImmediate(boolean pSavingImmediate)
Sets whether the CellEditor should save immediate.

Specified by:
setSavingImmediate in interface IEditor
Parameters:
pSavingImmediate - true, if the CellEditor should save immediate.

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

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

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.

getCellFormatter

public ICellFormatter getCellFormatter()
Gets the ICellFormatter.

The ICellFormatter will be called for every cell and can return a style for that cell.

Specified by:
getCellFormatter in interface ICellFormatable
Returns:
the ICellFormatter.
See Also:
ICellFormatable.setCellFormatter(ICellFormatter)

setCellFormatter

public void setCellFormatter(ICellFormatter pCellFormatter)
Sets the ICellFormatter.

The ICellFormatter will be called for every cell and can return a style for that cell.

Specified by:
setCellFormatter in interface ICellFormatable
Parameters:
pCellFormatter - the ICellFormatter.
See Also:
ICellFormatable.getCellFormatter()

getCellFormat

public CellFormat getCellFormat(IDataBook pDataBook,
                                IDataPage pDataPage,
                                IDataRow pDataRow,
                                java.lang.String pColumnName,
                                int pRow,
                                int pColumn)
                         throws java.lang.Throwable
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.
Throws:
java.lang.Throwable - if an exception, it is ignored.

setTranslation

public void setTranslation(TranslationMap pTranslation)
Sets the possible translations.

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

getTranslation

public TranslationMap getTranslation()
Gets the possible translation mapping.

Specified by:
getTranslation in interface ITranslatable
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 java.lang.String translate(java.lang.String pText)
Method to translate a given text.

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

setBorderVisible

public void setBorderVisible(boolean pVisible)
Sets the border of the text field visible or invisible.

Specified by:
setBorderVisible in interface IEditor
Parameters:
pVisible - true to set the border visible or false to hide the border

isBorderVisible

public boolean isBorderVisible()
Returns whether the the border of the text field is visible.

Specified by:
isBorderVisible in interface IEditor
Returns:
true if the border is visible, false if the border is invisible

setHorizontalAlignment

public void setHorizontalAlignment(int pHorizontalAlignment)
Sets the horizontal alignment. Possible values are defined in AlignmentConstants.

Specified by:
setHorizontalAlignment in interface IAlignmentConstants
Overrides:
setHorizontalAlignment in class AwtComponent<JVxEditor>
Parameters:
pHorizontalAlignment - the new vertical alignment

setVerticalAlignment

public void setVerticalAlignment(int pVerticalAlignment)
Sets the vertical alignment. Possible values are defined in AlignmentConstants.

Specified by:
setVerticalAlignment in interface IAlignmentConstants
Overrides:
setVerticalAlignment in class AwtComponent<JVxEditor>
Parameters:
pVerticalAlignment - the new vertical alignment

getName

public java.lang.String getName()
Gets the name of the object. Implementing classes need to make sure that no name is set during the creation of the component. A unique name (based on the position of the component in the component tree) will be generated and set when the component is added, but only if the name of the component is null.

Specified by:
getName in interface IComponent
Specified by:
getName in interface INamedObject
Overrides:
getName in class AwtComponent<JVxEditor>
Returns:
this component's name
See Also:
IComponent.setName(java.lang.String)

setName

public void setName(java.lang.String pName)
Sets the name of the object to the specified string.

Specified by:
setName in interface IComponent
Specified by:
setName in interface INamedObject
Overrides:
setName in class AwtComponent<JVxEditor>
Parameters:
pName - the string that is to be this component's name
See Also:
IComponent.getName()


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.