public abstract class ChooseFieldCommand extends CommandBase
Modifier and Type | Field and Description |
---|---|
protected FieldChooser |
fieldChooser |
protected static Field[] |
NO_FIELDS |
recordable, repeatable
Modifier | Constructor and Description |
---|---|
protected |
ChooseFieldCommand() |
Modifier and Type | Method and Description |
---|---|
protected FieldChoice |
chooseField(Component dialogParent,
FieldChoices choices) |
protected abstract CommandResult |
doExecute(DocumentView docView,
String parameter,
FieldChoice choice) |
CommandResult |
doExecute(DocumentView docView,
String parameter,
int x,
int y)
Actually executes this command with specified parameter and in
specified context.
|
protected abstract FieldChoice |
getPreparedFieldChoice()
Returns the field choice created by
CommandBase.prepare(com.xmlmind.xmledit.view.DocumentView, java.lang.String, int, int) corresponding to
the "complete parameter" passed to this method. |
abstract FieldChoices |
listFieldChoices(DocumentView docView,
String parameter)
List all possible field choices for this command given
specified selection (obtained through argument
docView )
and specified parameter. |
protected abstract void |
resetCommand() |
doExecuteByName, execute, executeCommand, isRecordable, isRepeatable, prepare, prepareCommand
protected FieldChooser fieldChooser
protected static final Field[] NO_FIELDS
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 abstract FieldChoice getPreparedFieldChoice()
CommandBase.prepare(com.xmlmind.xmledit.view.DocumentView, java.lang.String, int, int)
corresponding to
the "complete parameter" passed to this method.
Returns null
if there is no such field choice because
this command is to be run interactively.
Method doExecute(com.xmlmind.xmledit.view.DocumentView, java.lang.String, int, int)
is implemented as follows:
FieldChoice choice = getPreparedFieldChoice(); if (choice == null) { FieldChoices choices = listFieldChoices(docView, parameter); ...
public abstract FieldChoices listFieldChoices(DocumentView docView, String parameter)
docView
)
and specified parameter.
Method doExecute(com.xmlmind.xmledit.view.DocumentView, java.lang.String, int, int)
is implemented as follows:
FieldChoice choice = getPreparedFieldChoice(); if (choice == null) { FieldChoices choices = listFieldChoices(docView, parameter); ...
getPreparedFieldChoice()
protected FieldChoice chooseField(Component dialogParent, FieldChoices choices)
protected abstract CommandResult doExecute(DocumentView docView, String parameter, FieldChoice choice)
protected abstract void resetCommand()