Class InplaceEditorAdapter
java.lang.Object
ro.sync.ecss.extensions.api.editor.InplaceEditorAdapter
- All Implemented Interfaces:
InplaceEditor,Extension
@API(type=EXTENDABLE,
src=PUBLIC)
public abstract class InplaceEditorAdapter
extends Object
implements InplaceEditor
Convenience implementation of the
InplaceEditor.
By extending this adapter you are protected if any new methods are added
inside InplaceEditor.- Since:
- 14.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEditingListener(InplaceEditingListener editingListener) Adds a listener to receive edit notifications: -InplaceEditingListener.editingCanceled()to remove the editor and cancel the edit operation.voidCancels the editing process.getEditorComponent(AuthorInplaceContext context, Rectangle allocation, Point mouseInvocationLocation) Prepare and return the editor component.Returns a rectangle that should be made visible after the editor is shown.getValue()Gets the value that the user entered.voidrefresh(AuthorInplaceContext context) While this editor is inside an editing session a document change was detected that didn't originated form this editor.voidremoveEditingListener(InplaceEditingListener editingListener) Removes a listener that receives editing events.voidRequests focus inside the editing component.voidStops the editing and commits the current value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ro.sync.ecss.extensions.api.editor.InplaceEditor
allowsRepostingEvents, commitValue, insertContent
-
Constructor Details
-
InplaceEditorAdapter
public InplaceEditorAdapter()
-
-
Method Details
-
getDescription
- Specified by:
getDescriptionin interfaceExtension- Returns:
- The description of the extension.
- See Also:
-
getEditorComponent
public Object getEditorComponent(AuthorInplaceContext context, Rectangle allocation, Point mouseInvocationLocation) Description copied from interface:InplaceEditorPrepare and return the editor component.- Specified by:
getEditorComponentin interfaceInplaceEditor- Parameters:
context- The context where the editor will be used.allocation- The bounds where the editor will be shown. This is normally the bounds of the box in which the value being edited is rendered. If the editor requires to be presented in different bounds it should alter this parameter. The X,Y coordinates are relative to the parent in which the editor will be added.mouseInvocationLocation- if the editor was requested using the mouse this parameter represents the X,Y location where the event took place. It is relative to the parent in which the editor will be added.nullif the editor wasn't requested through mouse interaction.
OBS: This is the very first call received by an editor. This ensures that the editor is properly initialized for the subsequent calls (like aInplaceEditor.requestFocus()call).
OBS: An editor implementation will have to add listeners onto itself like:- a
KeyListenerfor handling key events like: ENTER to stop editing (by callingInplaceEditingListener.editingStopped(EditingEvent)) and ESCAPE to cancel it (by callingInplaceEditingListener.editingCanceled()). - a
FocusListenerto stop editing when the focus is given to a component that is not part of the editor (by callingInplaceEditingListener.editingStopped(EditingEvent)). - a
DocumentListenerto fireInplaceEditingListener.editingOccured()events (If the editor has a document).
- a
- Returns:
- The component that performs the editing. For the Standalone distribution this should be a java.awt.JComponent implementation. For the Eclipse plugin distribution, an org.eclipse.swt.widgets.Control is expected.
- See Also:
-
getScrollRectangle
Description copied from interface:InplaceEditorReturns a rectangle that should be made visible after the editor is shown. The coordinate should be relative to the editor itself. The default behavior is to make the entire editor visible but if the editor is bigger than the viewport the visible part might not be the right one. For example is the editor is a text field the caret might not be visible. This is when this method is useful. The caret rectangle should be returned so that the part of the editor with the caret is presented.- Specified by:
getScrollRectanglein interfaceInplaceEditor- Returns:
- A rectangle to be made visible or
nullto make the entire editor visible. - See Also:
-
addEditingListener
Description copied from interface:InplaceEditorAdds a listener to receive edit notifications: -InplaceEditingListener.editingCanceled()to remove the editor and cancel the edit operation. -InplaceEditingListener.editingOccured()to signal modification in the editor. This event marks the editor as dirty and it's value will be committed when aInplaceEditingListener.editingStopped(EditingEvent)is received. -InplaceEditingListener.editingStopped(EditingEvent)to end editing and commit it's value if needed. The value is usually committed ONLY if aInplaceEditingListener.editingOccured()was fired. SeeInplaceEditingListener.editingStopped(EditingEvent)for more information.- Specified by:
addEditingListenerin interfaceInplaceEditor- Parameters:
editingListener- Editing listener.- See Also:
-
requestFocus
public void requestFocus()Description copied from interface:InplaceEditorRequests focus inside the editing component.- Specified by:
requestFocusin interfaceInplaceEditor- See Also:
-
getValue
Description copied from interface:InplaceEditorGets the value that the user entered.- Specified by:
getValuein interfaceInplaceEditor- Returns:
- The value that the user entered.
- See Also:
-
stopEditing
public void stopEditing()Description copied from interface:InplaceEditorStops the editing and commits the current value. The editor should release any held resources and notifyInplaceEditingListener.editingStopped(EditingEvent). OBS: The current value will be committed only if at least oneInplaceEditingListener.editingOccured()event was issued before this moment.- Specified by:
stopEditingin interfaceInplaceEditor- See Also:
-
cancelEditing
public void cancelEditing()Description copied from interface:InplaceEditorCancels the editing process. The editor should release any held resources and notifyInplaceEditingListener.editingCanceled().- Specified by:
cancelEditingin interfaceInplaceEditor- See Also:
-
removeEditingListener
Description copied from interface:InplaceEditorRemoves a listener that receives editing events.- Specified by:
removeEditingListenerin interfaceInplaceEditor- Parameters:
editingListener- Editing listener.- See Also:
-
refresh
Description copied from interface:InplaceEditorWhile this editor is inside an editing session a document change was detected that didn't originated form this editor. In this situation it might be good for the editor to refresh the presented data.
Currently this method is called if:- This editor edits an attribute and the same attribute was externally modified. In this situation is recommended for the editor to update the current value.
- Specified by:
refreshin interfaceInplaceEditor- Parameters:
context- An updated editing context for this editor.- See Also:
-