public class EditAttribute extends CommandBase implements MacroRecorder.Paste
editAttribute
.Modifier and Type | Class and Description |
---|---|
protected static class |
EditAttribute.AutoValue |
Modifier and Type | Field and Description |
---|---|
protected Name |
attributeName |
protected String |
attributeValue |
protected EditAttribute.AutoValue |
autoValue |
protected boolean |
simplePrompt |
recordable, repeatable
Modifier | Constructor and Description |
---|---|
|
EditAttribute() |
protected |
EditAttribute(boolean repeatable) |
Modifier and Type | Method and Description |
---|---|
CommandResult |
doExecute(DocumentView docView,
String parameter,
int x,
int y)
Actually executes this command with specified parameter and in
specified context.
|
protected ElementEditor |
doPrepare(DocumentView docView,
String parameter) |
protected String |
getAttributeValue(DocumentView docView,
boolean[] checkValue) |
String |
getPossiblyPastedText(String parameter)
Returns the substring possibly pasted from the clipboard and
contained in specified parameter.
|
protected String |
makeRepeatParameter(String parameter) |
boolean |
prepare(DocumentView docView,
String parameter,
int x,
int y)
Tests whether this command can be executed with specified parameter
and in specified context.
|
static String |
prompt(Element editedElement,
Name attributeName) |
protected String |
selectAttributeValue(DocumentView docView,
boolean addAttribute) |
String |
setPossiblyPastedText(String parameter,
String replacement)
Replaces in specified parameter the substring possibly pasted
from the clipboard (as returned by
MacroRecorder.Paste.getPossiblyPastedText(java.lang.String) )
by specified replacement. |
String[] |
splitPossiblyPastedText(String parameter) |
doExecuteByName, execute, executeCommand, isRecordable, isRepeatable, prepareCommand
protected boolean simplePrompt
protected EditAttribute.AutoValue autoValue
protected Name attributeName
protected String attributeValue
public EditAttribute()
protected EditAttribute(boolean repeatable)
public boolean prepare(DocumentView docView, String parameter, int x, int y)
CommandBase
If the command can be executed, this method returns
true
after having configured its internal state for
consumption by method CommandBase.execute(com.xmlmind.xmledit.view.DocumentView, java.lang.String, int, int)
which should be invoked
immediately after this one.
Returns false
if this command cannot be executed with
specified parameter and in specified context.
prepare
in class CommandBase
docView
- the target of this commandparameter
- parameterizes the command (that is, modifies the
behavior of the command in a command specific way)x
- X position relative to docView of the mouse event
having triggered this command; -1 if this command was triggered by a
keyboard inputy
- Y position relative to docView of the mouse event
having triggered this command; -1 if this command was triggered by a
keyboard inputprotected ElementEditor doPrepare(DocumentView docView, String parameter)
public CommandResult doExecute(DocumentView docView, String parameter, int x, int y)
CommandBase
This method assumes that CommandBase.prepare(com.xmlmind.xmledit.view.DocumentView, java.lang.String, int, int)
has been
successfully invoked immediately before its own invocation.
IMPORTANT: application code which executes a command
must always use CommandBase.execute(com.xmlmind.xmledit.view.DocumentView, java.lang.String, int, int)
or CommandBase.executeCommand(com.xmlmind.xmledit.gadget.Gadget, java.lang.String, int, int)
to do so,
NOT CommandBase.doExecute(com.xmlmind.xmledit.view.DocumentView, java.lang.String, int, int)
. CommandBase.doExecute(com.xmlmind.xmledit.view.DocumentView, java.lang.String, int, int)
is intended to be used
only by commands which invoke helper "sub-commands".
doExecute
in class CommandBase
docView
- the target of this commandparameter
- parameterizes the command (that is, modifies the
behavior of the command in a command specific way)x
- X position relative to docView of the mouse event
having triggered this command; -1 if this command was triggered by a
keyboard inputy
- Y position relative to docView of the mouse event
having triggered this command; -1 if this command was triggered by a
keyboard inputnull
.
If the command execution is successful and
the command is repeatable and/or recordable then
CommandResult.details
field of the result is expected
to be one of:
null
Object
String
s
protected String getAttributeValue(DocumentView docView, boolean[] checkValue)
protected String selectAttributeValue(DocumentView docView, boolean addAttribute)
public String getPossiblyPastedText(String parameter)
MacroRecorder.Paste
null
.
Example: putAttribute returns the attribute value part of specified parameter.
getPossiblyPastedText
in interface MacroRecorder.Paste
parameter
- the parameter of the commandnull
.public String setPossiblyPastedText(String parameter, String replacement)
MacroRecorder.Paste
MacroRecorder.Paste.getPossiblyPastedText(java.lang.String)
)
by specified replacement.setPossiblyPastedText
in interface MacroRecorder.Paste
parameter
- the parameter of the commandreplacement
- a replacement for the substring possibly pasted
from the clipboard