public class AddBlockInFlow extends CommandBase
addBlockInFlow
.Modifier and Type | Field and Description |
---|---|
protected Node |
beforeNode |
protected ElementTemplates |
elementTemplates |
protected static Name |
INLINE_ELEMENT_NAMES_PROPERTY |
protected Field |
insertField |
protected Name |
insertName |
protected ElementTemplate |
insertTemplate |
protected ArrayList<Field> |
list |
recordable, repeatable
Constructor and Description |
---|
AddBlockInFlow() |
Modifier and Type | Method and Description |
---|---|
protected static boolean |
canContain(Element element,
Name childName,
DocumentType docType) |
CommandResult |
doExecute(DocumentView docView,
String parameter,
int x,
int y)
Actually executes this command with specified parameter and in
specified context.
|
protected Map<Name,Name> |
doGetInlineNames(Document doc,
DocumentType docType,
String parameter) |
protected boolean |
doParseInsertName(String parameter,
int offset,
Document doc) |
static boolean |
getChildElementNames(DocumentType docType,
Name parentName,
Object result)
Return the names of the child elements of specified parent element.
|
protected Map<Name,Name> |
getInlineNames(Document doc,
DocumentType docType,
String parameter) |
static boolean |
parseInlineElementNames(Document doc,
DocumentType docType,
Map<Name,Name> inlineNameSet)
Parse inline element names from system property
"
$c inlineElementNames ". |
protected boolean |
parseInsertName(String parameter,
Document doc) |
boolean |
prepare(DocumentView docView,
String parameter,
int x,
int y)
Tests whether this command can be executed with specified parameter
and in specified context.
|
doExecuteByName, execute, executeCommand, isRecordable, isRepeatable, prepareCommand
protected Name insertName
protected ElementTemplate insertTemplate
protected ElementTemplates elementTemplates
protected Node beforeNode
protected Field insertField
protected static final Name INLINE_ELEMENT_NAMES_PROPERTY
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 static final boolean canContain(Element element, Name childName, DocumentType docType)
protected Map<Name,Name> getInlineNames(Document doc, DocumentType docType, String parameter)
protected Map<Name,Name> doGetInlineNames(Document doc, DocumentType docType, String parameter)
public static final boolean parseInlineElementNames(Document doc, DocumentType docType, Map<Name,Name> inlineNameSet)
$c inlineElementNames
".doc
- document being editedinlineNameSet
- to be filled with parsed namestrue
if success or false
if system property does not exist or its content cannot be parsedpublic static final boolean getChildElementNames(DocumentType docType, Name parentName, Object result)
docType
- type of the document containing the parent elementparentName
- name of the parent elementresult
- to be filled with child element names;
a Map<Name,Name>
or a List<Name>
true
if success or false
if the type of parent element cannot be determinedpublic 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