- All Implemented Interfaces:
- java.io.Serializable
public abstract class DialogJob
extends Job
A Job which takes parameters; the parameters may be specified
programmatically or via a dialog box which is constructed on the
fly using reflection. In the future this class will also handle
the drudgery of remembering the last values in all of the dialog's
fields so the programmer doesn't have to write that code by hand.
Much like emacs, most of Electric's functionality can be invoked
in two different ways: programmatically from scripts/code, or
interactively via a graphical user interface. It is rather
tedious to have to maintain these two interfaces separately and
keeping them consistent is error-prone. Therefore, the DialogJob
class lets a programmer write only the programmatic interface (the
Job's constructor), annotate it appropriately, and have the
graphical user interface be generated automatically (like emacs
does). The added advantage is that the dialog box acts as
documentation for the scripting API: a script-writer who wants to
know how to script some feature need only look at the dialog box's
field labels in order to know how to invoke that feature
programmatically.
This code will scan the public fields of the class in which it
finds itself (subclasses are expected to add fields); any field
whose name both begins and ends with an underscore is treated as a
dialog field. The type of user interface component to instantiate
is determined by the field's type; the following types are
understood, any other type is illegal:
String - a JTextArea
int - a JTextArea
long - a JTextArea
float - a JTextArea
double - a JTextArea
File - a button which pops up a "choose file" dialog
There are a few special fields which are used to indicate that the
Job is only meaningful when the current window is looking at a
particular kind of thing. Error handling (for the case where the
user invokes the Job in another situation) is handled in this
class so that it need not be repeated.
public Cell _thisCell_;
public WaveformWindow _thisWaveformWindow_;
- Author:
- Adam Megacz
- See Also:
- Serialized Form