Class AuthorInplaceContext
java.lang.Object
ro.sync.ecss.extensions.api.editor.AuthorInplaceContext
Context where an edit component will be used. Contains all the information
required to build the editor.
- Since:
- 14.1
-
Constructor Summary
ConstructorDescriptionAuthorInplaceContext
(Map<String, Object> arguments, AuthorElement elem, Styles styles, AuthorSchemaManager schemaManager, AuthorAccess authorAccess, Object parentHost, DynamicPropertyEvaluator propsEvaluator) The editor context.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.static String
getAttributeToEdit
(String toEdit) Checks if the propertyInplaceEditorCSSConstants.PROPERTY_EDIT
specifies an attribute to be edited.The QName of the edited attribute.getElem()
Get the element being edited.The parent host in which the editor will be added or the renderer will be painted.Some form control properties can't be evaluated at the time the CSS is compiled.If the mouse is currently hovering the area of this editor this represents the X,Y location relative to the editor bounds.boolean
Checks if the form control is added in a context where changes are not permitted.void
setErrorMessage
(String errorMessage) Sets an error message encountered while building the context.void
setParentHost
(Object parentHost) The parent host in which the editor will be added or the renderer will be painted.void
setReadOnlyContext
(boolean readOnlyContext) Sets if the form control is added in a context where editing is not permitted.void
setRelativeMousePosition
(Point relativeMousePosition) If the mouse is currently hovering the area of this editor this represents the X,Y location relative to the editor bounds.
-
Constructor Details
-
AuthorInplaceContext
public AuthorInplaceContext(Map<String, Object> arguments, AuthorElement elem, Styles styles, AuthorSchemaManager schemaManager, AuthorAccess authorAccess, Object parentHost, DynamicPropertyEvaluator propsEvaluator) The editor context.- Parameters:
arguments
- The editor argumentselem
- The element being edited.styles
- The styles of the element where the editing takes placeschemaManager
- Provides support for obtaining information about what elements, attributes can be inserted in a given context.authorAccess
- Provides access to different functions.parentHost
- The parent host in which the editor will be added or the renderer will be painted. If we are in the stand-alone Oxygen version this will be a JPanel. If we are in the Oxygen Eclipse plug-in this will be a Composite. For SWT, an editor will require the parent in order to create itself.propsEvaluator
- Some form control properties can't be evaluated at the time the CSS is compiled. This interface can be used by form controls to expand such properties.
-
AuthorInplaceContext
Copy constructor.- Parameters:
copy
- Another context object to copy from.
-
-
Method Details
-
getPropertyEvaluator
Some form control properties can't be evaluated at the time the CSS is compiled. This interface can be used by form controls to expand such properties.- Returns:
- A property evaluator.
- Since:
- 16.1
-
getArguments
- Returns:
- The arguments from the oxy_editor function as well as some others. The keys
are the constants from class
InplaceEditorArgumentKeys
.
-
getAttributeToEdit
Deprecated.UsegetAttributeToEditQName()
instead. This method returns the attribute name as it was specified in the CSS. If a QName was specified then this QName might not be valid in the context of the current element. PropertyInplaceEditorArgumentKeys.PROPERTY_EDIT_QUALIFIED
should be used in these situations.- Returns:
- The attribute being edited as extracted from the oxy_editor arguments.
null
no attribute was specified in which case the text should be edited.
-
getAttributeToEditQName
The QName of the edited attribute.- Returns:
- The QName of the edited attribute or
null
if not editing an attribute.
-
getAttributeToEdit
Checks if the propertyInplaceEditorCSSConstants.PROPERTY_EDIT
specifies an attribute to be edited.- Parameters:
toEdit
- The value of the propertyInplaceEditorCSSConstants.PROPERTY_EDIT
- Returns:
- The attribute being edited as extracted from the oxy_editor arguments.
null
if no attribute name was specified.
-
getElem
Get the element being edited.- Returns:
- The element being edited. If a processing instruction is being edited, the returned object is an instance of ro.sync.ecss.extensions.api.node.ArtificialNode and you can obtain the wrapped PI from it.
-
getSchemaManager
- Returns:
- Returns the schemaManager.
-
getAuthorAccess
- Returns:
- Provides access to different author functions.
-
getParentHost
The parent host in which the editor will be added or the renderer will be painted. If we are in the stand-alone Oxygen version this will be aJPanel
. If we are in the Oxygen Eclipse plug-in, forInplaceEditor
this will be aComposite
and forInplaceRenderer
it will be aJPanel
. For SWT, an editor will require the parent in order to create itself.- Returns:
- The
JPanel
orComposite
of the author.
-
setErrorMessage
Sets an error message encountered while building the context.- Parameters:
errorMessage
- An error message encountered while building the context.
-
getErrorMessage
- Returns:
- An error message encountered while building the context.
-
getStyles
- Returns:
- Returns the styles of the element where the editing takes place.
-
setRelativeMousePosition
If the mouse is currently hovering the area of this editor this represents the X,Y location relative to the editor bounds. The editor might choose to render itself differently in this situation. For example a button editor might paint a special highlight as a feedback that an action can be performed.null
if the mouse is not over the editor. This information is relevant only when the editor is painted. When editing is started the editor can just add mouse listeners onto itself.- Parameters:
relativeMousePosition
- The mouse location if the mouse is over the editor.
-
getRelativeMouseLocation
If the mouse is currently hovering the area of this editor this represents the X,Y location relative to the editor bounds. The editor might choose to render itself differently in this situation. For example a button editor might paint a special highlight as a feedback that an action can be performed.null
if the mouse is not over the editor. This information is relevant only when the editor is painted. When editing is started the editor can just add mouse listeners onto itself.- Returns:
- The mouse location if the mouse is over the editor.
-
setReadOnlyContext
public void setReadOnlyContext(boolean readOnlyContext) Sets if the form control is added in a context where editing is not permitted.- Parameters:
readOnlyContext
-true
if this form control is added in a context where changes are not permitted.
-
isReadOnlyContext
public boolean isReadOnlyContext()Checks if the form control is added in a context where changes are not permitted. In this situation the form control will automatically be rendered as disabled. A form control implementation might look to this flag to dynamically change things. For example a pop-up form control usually presents a message that says: "Click to edit....". In a read-only context this tooltip will not be presented anymore.- Returns:
true
if this form control is added in a context where changes are not permitted.
-
setParentHost
The parent host in which the editor will be added or the renderer will be painted. If we are in the stand-alone Oxygen version this will be a JPanel.- Parameters:
parentHost
- The host to set.
-
getAttributeToEditQName()
instead.