Oxygen XML Editor 16.1 Author API

ro.sync.ecss.extensions.commons.editor
Class SimpleURLChooserEditor

java.lang.Object
  extended by ro.sync.ecss.extensions.api.editor.AbstractInplaceEditor
      extended by ro.sync.ecss.extensions.commons.editor.SimpleURLChooserEditor
All Implemented Interfaces:
InplaceEditor, InplaceRenderer, Extension

@API(type=INTERNAL,
     src=PUBLIC)
public class SimpleURLChooserEditor
extends AbstractInplaceEditor
implements InplaceRenderer

Simple URL Chooser in-place editor.


Constructor Summary
SimpleURLChooserEditor()
          Constructor.
 
Method Summary
 void cancelEditing()
          Cancels the editing process.
protected  javax.swing.JTextField createTextField()
          Creates the text field used to display the selected URL and installs the UNDO support on it.
 CursorType getCursorType(AuthorInplaceContext context, int x, int y)
          Get a cursor to be used when the user hovers with the mouse over this renderer.
 CursorType getCursorType(int x, int y)
          Get a cursor to be used when the user hovers with the mouse over this renderer.
 java.lang.String getDescription()
           
 java.lang.Object getEditorComponent(AuthorInplaceContext context, Rectangle allocation, Point mouseLocation)
          Prepare and return the editor component.
 java.lang.Object getRendererComponent(AuthorInplaceContext context)
          Initialize the renderer with the given context and returns the component.
 RendererLayoutInfo getRenderingInfo(AuthorInplaceContext context)
          Returns the rendering layout info.
 Rectangle getScrollRectangle()
          Returns a rectangle that should be made visible after the editor is shown.
 java.lang.String getTooltipText(AuthorInplaceContext context, int x, int y)
          Gets a tooltip text to be presented when the cursor is over this renderer.
 java.lang.Object getValue()
          Gets the value that the user entered.
 boolean insertContent(java.lang.String content)
          An insert text event was received by the author page and redirected to this currently active form control.
 void refresh(AuthorInplaceContext context)
          While this editor is inside an editing session a document change was detected that didn't originated form this editor.
 void requestFocus()
          Requests focus inside the editing component.
 void stopEditing()
          Stops the editing and commits the current value.
 
Methods inherited from class ro.sync.ecss.extensions.api.editor.AbstractInplaceEditor
addEditingListener, fireCommitValue, fireEditingCanceled, fireEditingOccured, fireEditingStopped, fireNextEditLocationRequested, firePreviousEditLocationRequested, getBoolean, removeEditingListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleURLChooserEditor

public SimpleURLChooserEditor()
Constructor.

Method Detail

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface Extension
Returns:
The description of the extension.
See Also:
Extension.getDescription()

getRendererComponent

public java.lang.Object getRendererComponent(AuthorInplaceContext context)
Description copied from interface: InplaceRenderer
Initialize the renderer with the given context and returns the component. It's up to the caller to use the renderer to paint.

Specified by:
getRendererComponent in interface InplaceRenderer
Parameters:
context - The editing context.
Returns:
The renderer. A java.awt.Component implementation.
See Also:
InplaceRenderer.getRendererComponent(ro.sync.ecss.extensions.api.editor.AuthorInplaceContext)

getRenderingInfo

public RendererLayoutInfo getRenderingInfo(AuthorInplaceContext context)
Description copied from interface: InplaceRenderer
Returns the rendering layout info. This contains information about the baseline and the size in a certain context. The baseline is measured from the top of the component. Because a renderer is reused, when this call is received, the renderer must re-initialize itself from the given context.

Specified by:
getRenderingInfo in interface InplaceRenderer
Parameters:
context - The editing context.
Returns:
The rendering layout info.
See Also:
InplaceRenderer.getRenderingInfo(ro.sync.ecss.extensions.api.editor.AuthorInplaceContext)

getTooltipText

public java.lang.String getTooltipText(AuthorInplaceContext context,
                                       int x,
                                       int y)
Description copied from interface: InplaceRenderer
Gets a tooltip text to be presented when the cursor is over this renderer. Because a renderer is reused, when this called is received, the renderer must re-initialize itself from the given context.

Specified by:
getTooltipText in interface InplaceRenderer
Parameters:
context - The editing context.
x - The x coordinate relative to the renderer bounds.
y - The y coordinate relative to the renderer bounds.
Returns:
A tooltip text or null if no tooltip.
See Also:
InplaceRenderer.getTooltipText(ro.sync.ecss.extensions.api.editor.AuthorInplaceContext, int, int)

getEditorComponent

public java.lang.Object getEditorComponent(AuthorInplaceContext context,
                                           Rectangle allocation,
                                           Point mouseLocation)
Description copied from interface: InplaceEditor
Prepare and return the editor component.

Specified by:
getEditorComponent in interface InplaceEditor
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.
mouseLocation - 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. null if 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 a InplaceEditor.requestFocus() call).
OBS: An editor implementation will have to add listeners onto itself like:
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:
InplaceEditor.getEditorComponent(ro.sync.ecss.extensions.api.editor.AuthorInplaceContext, ro.sync.exml.view.graphics.Rectangle, ro.sync.exml.view.graphics.Point)

getScrollRectangle

public Rectangle getScrollRectangle()
Description copied from interface: InplaceEditor
Returns 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:
getScrollRectangle in interface InplaceEditor
Returns:
A rectangle to be made visible or null to make the entire editor visible.
See Also:
InplaceEditor.getScrollRectangle()

requestFocus

public void requestFocus()
Description copied from interface: InplaceEditor
Requests focus inside the editing component.

Specified by:
requestFocus in interface InplaceEditor
See Also:
InplaceEditor.requestFocus()

getValue

public java.lang.Object getValue()
Description copied from interface: InplaceEditor
Gets the value that the user entered.

Specified by:
getValue in interface InplaceEditor
Returns:
The value that the user entered.
See Also:
InplaceEditor.getValue()

stopEditing

public void stopEditing()
Description copied from interface: InplaceEditor
Stops the editing and commits the current value. The editor should release any held resources and notify InplaceEditingListener.editingStopped(EditingEvent). OBS: The current value will be committed only if at least one InplaceEditingListener.editingOccured() event was issued before this moment.

Specified by:
stopEditing in interface InplaceEditor
See Also:
InplaceEditor.stopEditing()

cancelEditing

public void cancelEditing()
Description copied from interface: InplaceEditor
Cancels the editing process. The editor should release any held resources and notify InplaceEditingListener.editingCanceled().

Specified by:
cancelEditing in interface InplaceEditor
See Also:
InplaceEditor.cancelEditing()

createTextField

protected javax.swing.JTextField createTextField()
Creates the text field used to display the selected URL and installs the UNDO support on it.

Returns:
The text field used to display the selected URL.

getCursorType

public CursorType getCursorType(AuthorInplaceContext context,
                                int x,
                                int y)
Description copied from interface: InplaceRenderer
Get a cursor to be used when the user hovers with the mouse over this renderer. For a more complex renderer, the given X,Y coordinates can be used to decide what cursor to return.

Specified by:
getCursorType in interface InplaceRenderer
Parameters:
context - The editing context. Useful if the renderer is a more complex one, like a text field with an associated button and wants to provide different cursors when the cursor is over the textfield or over the button. In this case the renderer will have to initialize itself with this context in order to decide what the cursor is hovering.
x - The x coordinate relative to the renderer bounds.
y - The y coordinate relative to the renderer bounds.
Returns:
The type of cursor to be used or null to let the viewport decide.
See Also:
InplaceRenderer.getCursorType(ro.sync.ecss.extensions.api.editor.AuthorInplaceContext, int, int)

getCursorType

public CursorType getCursorType(int x,
                                int y)
Description copied from interface: InplaceRenderer
Get a cursor to be used when the user hovers with the mouse over this renderer. For a more complex renderer, the given X,Y coordinates can be used to decide what cursor to return. We recommend using InplaceRenderer.getCursorType(AuthorInplaceContext, int, int) as you can use the provided context to get additional information.

Specified by:
getCursorType in interface InplaceRenderer
Parameters:
x - The x coordinate relative to the renderer bounds.
y - The y coordinate relative to the renderer bounds.
Returns:
The type of cursor to be used or null to let the viewport decide.
See Also:
InplaceRenderer.getCursorType(int, int)

refresh

public void refresh(AuthorInplaceContext context)
Description copied from interface: InplaceEditor
While 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.

Specified by:
refresh in interface InplaceEditor
Overrides:
refresh in class AbstractInplaceEditor
Parameters:
context - An updated editing context for this editor.
See Also:
InplaceEditor.refresh(ro.sync.ecss.extensions.api.editor.AuthorInplaceContext)

insertContent

public boolean insertContent(java.lang.String content)
Description copied from interface: InplaceEditor
An insert text event was received by the author page and redirected to this currently active form control. The form control should insert this text as it sees fit. For example a text field might insert it at the caret position. An example when this event comes is when the user uses the Character Map Dialog to insert characters directly into a form control.

Specified by:
insertContent in interface InplaceEditor
Overrides:
insertContent in class AbstractInplaceEditor
Parameters:
content - Content to be inserted.
Returns:
true if the event was handled or false if the form control can do nothing with the string. For example a text field can insert the text inside it but a check box form control can do nothing with it. If false is returned the form control editing session will be stopped and the author page will handle the event instead.
See Also:
AbstractInplaceEditor.insertContent(java.lang.String)

Oxygen XML Editor 16.1 Author API

© Copyright SyncRO Soft SRL 2002 - 2014. All rights reserved.