public class CommandFormatter extends Object
Constructor and Description |
---|
CommandFormatter(CredibleString invocation,
boolean includeDflts,
LineEnder lineEnder,
int levelIndent,
int cwidth,
boolean addSuggestions)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static StyledDocument |
createBasicDocument(String txt)
Utility method returning a StyledDocument instance with some
supplied plain text.
|
Executable |
createExecutable(StiltsCommand command)
Creates a task Executable based on the state of this formatter.
|
StyledDocument |
createShellDocument(StiltsCommand command)
Returns a Document, suitable for use with a JTextPane,
formatting the given plot specification.
|
CredibleString |
getInvocation()
Returns the invocation used to introduce the STILTS command.
|
void |
populateEnvironment(StiltsCommand command,
MapEnvironment env)
Adds entries to a supplied execution environment corresponding to
the STILTS parameters defined by this specification.
|
void |
setForceError(boolean forceError)
Sets whether the generated stilts commands will be made to
produce a gratuitous error.
|
protected String[] |
stripExpectedUnused(Task task,
String[] words)
Remove words from the list of unused words that are harmless.
|
public CommandFormatter(CredibleString invocation, boolean includeDflts, LineEnder lineEnder, int levelIndent, int cwidth, boolean addSuggestions)
invocation
- display text to introduce the STILTS commandincludeDflts
- if true, all parameters are included;
if false, only those with non-default valueslineEnder
- line end presentation policylevelIndent
- number of spaces per indentation levelcwidth
- nominal formatting width in characters;
this affects line wrapping, but actual
wrapping may depend on other factors tooaddSuggestions
- if true, some parameters that might be useful
but are not necessary may be addedpublic CredibleString getInvocation()
public void setForceError(boolean forceError)
forceError
- true to force an error from generated commandspublic Executable createExecutable(StiltsCommand command) throws TaskException
If this method returns without error there is a fair chance that the serializations predicted from this object will represent legal STILTS commands.
command
- command specificationTaskException
- if there is some other error in setting up
the executable; probably incorrect parameter
assignments of some kindpublic StyledDocument createShellDocument(StiltsCommand command)
command
- command specificationprotected String[] stripExpectedUnused(Task task, String[] words)
This is a hook for a hack. Some of the parameter settings can be unused when object values for other parameter settings are used. If that happens, it looks like there is a problem because settings have not been used. This routine can pull them out so the warning goes away.
task
- taskwords
- input command word listpublic void populateEnvironment(StiltsCommand command, MapEnvironment env)
command
- command specificationenv
- execution environment to populate;
should probably be empty on entrypublic static StyledDocument createBasicDocument(String txt)
txt
- text contentCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.