javax.rad.genui.control
Class UIEditor

java.lang.Object
  extended by javax.rad.genui.UIResource<C>
      extended by javax.rad.genui.UIComponent<C>
          extended by javax.rad.genui.control.AbstractControllable<IEditor>
              extended by javax.rad.genui.control.UIEditor
All Implemented Interfaces:
IControl, IControllable, IEditorControl, ITranslatable, ICellFormatable, IEditor, IAlignmentConstants, IComponent, IResource, INamedObject, ITranslator

public class UIEditor
extends AbstractControllable<IEditor>
implements IEditor

Platform and technology independent Editor. It is designed for use with AWT, Swing, SWT, JSP, JSF, ... .


Field Summary
 
Fields inherited from class javax.rad.genui.UIComponent
bTranslate, lLastTranslationModified, parent, popupMenu
 
Fields inherited from class javax.rad.genui.UIResource
uiResource
 
Fields inherited from interface javax.rad.ui.IAlignmentConstants
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_STRETCH, ALIGN_TOP
 
Fields inherited from interface javax.rad.model.ui.IControllable
COMMAND_DELETE, COMMAND_DUPLICATE, COMMAND_EDIT, COMMAND_EXPORT, COMMAND_FIRST, COMMAND_INSERT, COMMAND_INSERT_SUB, COMMAND_LAST, COMMAND_NEXT, COMMAND_PREVIOUS, COMMAND_RESTORE, COMMAND_SEARCH
 
Constructor Summary
  UIEditor()
          Creates a new instance of UIEditor.
  UIEditor(IDataRow pDataRow, java.lang.String pColumnName)
          Creates a new instance of UIEditor.
protected UIEditor(IEditor pEditor)
          Creates a new instance of UIEditor with the given editor.
 
Method Summary
 void cancelEditing()
          Informs the GUI control, that the last edit should be canceled(restored) the correct value is in the DataBook.
protected  java.lang.String createComponentName()
          Creates a name for this UIComponent.
 void doEdit()
          Starts editing.
 IDataBook getActiveDataBook()
          Gets the controllable IDataBook for this IControllable.
 ICellEditor getCellEditor()
          Gets the CellEditor that edits the given column in the given DataRow.
 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.
 int getHorizontalAlignment()
          Returns the alignment along the x axis.
 int getVerticalAlignment()
          Returns the alignment along the y axis.
 boolean isBorderVisible()
          Returns whether the the border of the text field is visible.
 boolean isSavingImmediate()
          Tells whether the CellEditor should save immediate.
 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 setCellFormatter(java.lang.Object pCellFormatter, java.lang.String pMethodName)
          Sets the cell formatter.
 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 setSavingImmediate(boolean pSavingImmediate)
          Sets whether the CellEditor should save immediate.
 void setVerticalAlignment(int pVerticalAlignment)
          Sets the vertical alignment.
 void updateTranslation()
          Notification for updating the translation.
 
Methods inherited from class javax.rad.genui.control.AbstractControllable
addNotify, createCellFormatter, createNodeFormatter, doCommand, doDelete, doDuplicate, doExport, doFirst, doInsert, doInsertSub, doLast, doNext, doNotifyController, doPrevious, doRestore, doSearch, getController, isCommandEnabled, isDeleteEnabled, isDuplicateEnabled, isEditEnabled, isExportEnabled, isFirstEnabled, isInsertEnabled, isInsertSubEnabled, isLastEnabled, isNextEnabled, isPreviousEnabled, isRestoreEnabled, isSearchEnabled, removeNotify, setController
 
Methods inherited from class javax.rad.genui.UIComponent
beforeAddNotify, capture, createComponentNamePrefix, debug, doEventKey, doTriggerPopMenu, equals, error, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKey, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getComponentUIResource, getCurrentTranslation, getCursor, getDefaultName, getEventSource, getExistingNames, getFactory, getFont, getForeground, getLocation, getLocationOffset, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPopupMenu, getPreferredSize, getResource, getRootName, getSize, getStyle, getTabIndex, getToolTipText, getTranslation, getUIComponent, hashCode, incrementNameIfExists, info, invokeAndWait, invokeAndWait, invokeInThread, invokeInThread, invokeLater, invokeLater, isBackgroundSet, isBeforeNotified, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isNotified, isPreferredSizeSet, isTranslationChanged, isTranslationEnabled, isVisible, requestFocus, setBackground, setBounds, setBounds, setCursor, setDefaultName, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocation, setLocationRelativeTo, setMaximumSize, setMaximumSize, setMinimumSize, setMinimumSize, setName, setParent, setPopupMenu, setPreferredSize, setPreferredSize, setRootName, setSize, setSize, setStyle, setTabIndex, setToolTipText, setTranslation, setTranslationEnabled, setUIComponent, setVisible, translate
 
Methods inherited from class javax.rad.genui.UIResource
eventResourceChanged, eventResourceChanged, fireResourceChanged, getObject, getObjectNames, getUIResource, hasResourceHandler, putObject, 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
 
Methods inherited from interface javax.rad.model.ui.ITranslatable
getTranslation, isTranslationEnabled, setTranslation, setTranslationEnabled
 
Methods inherited from interface javax.rad.util.ITranslator
translate
 

Constructor Detail

UIEditor

public UIEditor()
Creates a new instance of UIEditor.

See Also:
IEditor

UIEditor

protected UIEditor(IEditor pEditor)
Creates a new instance of UIEditor with the given editor.

Parameters:
pEditor - the editor
See Also:
IEditor

UIEditor

public UIEditor(IDataRow pDataRow,
                java.lang.String pColumnName)
         throws ModelException
Creates a new instance of UIEditor.

Parameters:
pDataRow - the IDataRow.
pColumnName - the column name.
Throws:
ModelException - if the editor can't be initialized.
See Also:
IEditor
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)

getActiveDataBook

public IDataBook getActiveDataBook()
Gets the controllable IDataBook for this IControllable. IEditorControl should return the set data row, if it is instanceof IDataBook or null otherwise. ITableControl should return the set data book. ITreeControl should return the data book of the current selected node. The controller has to be informed, If the databook changes on a focused IControllable. eg: ITreeControl node selection of a different databook. Editor or table has the focus, and a different databook is set on editor or table.

Specified by:
getActiveDataBook in interface IControllable
Returns:
the controllable IDataBook

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.

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.

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

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()

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

getHorizontalAlignment

public int getHorizontalAlignment()
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. Possible values are defined in AlignmentConstants.

Specified by:
getHorizontalAlignment in interface IAlignmentConstants
Returns:
the horizontal alignment

setHorizontalAlignment

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

Specified by:
setHorizontalAlignment in interface IAlignmentConstants
Parameters:
pHorizontalAlignment - the new vertical alignment

getVerticalAlignment

public int getVerticalAlignment()
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. Possible values are defined in AlignmentConstants.

Specified by:
getVerticalAlignment in interface IAlignmentConstants
Returns:
the vertical alignment

setVerticalAlignment

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

Specified by:
setVerticalAlignment in interface IAlignmentConstants
Parameters:
pVerticalAlignment - the new vertical alignment

setCellFormatter

public void setCellFormatter(java.lang.Object pCellFormatter,
                             java.lang.String pMethodName)
Sets the cell formatter.

Parameters:
pCellFormatter - the cell formatter.
pMethodName - the method name.

updateTranslation

public void updateTranslation()
Notification for updating the translation. This method will be called when the UIComponent will be added to a displayable containment hierarchy, when its containment hierarchy is made displayable or the translation table will be changed.

Overrides:
updateTranslation in class UIComponent<IEditor>
See Also:
UIComponent.setTranslation(TranslationMap), UIComponent.addNotify()

createComponentName

protected java.lang.String createComponentName()
Creates a name for this UIComponent. The returned name needs to be unique in the current root/workscreen and is ideally, but not necessarily, prefixed with the UIComponent.sRootName, if there is any. Overriding classes should be aware that this method will be called in UIComponent.addNotify() and the returned name will only be assigned to the UIComponent if there isn't already a name set. Also UIComponent.stExistingNames can be used to find out if a name has already been assigned, and UIComponent.sRootName to get the root name. In rare cases UIComponent.stExistingNames and/or UIComponent.sRootName might be null when this method is called.

Overrides:
createComponentName in class UIComponent<IEditor>
Returns:
a unique name for this UIComponent.
See Also:
UIComponent.getExistingNames(), UIComponent.getRootName(), UIComponent.incrementNameIfExists(String, Set, boolean)

doEdit

public void doEdit()
            throws ModelException
Starts editing.

Overrides:
doEdit in class AbstractControllable<IEditor>
Throws:
ModelException - if an edit error occurs


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.