public class Chooser extends ListWidget implements java.awt.event.ActionListener
Modifier and Type | Field and Description |
---|---|
static javax.swing.Icon |
WIDGET_ICON
The icon for the widget
|
BLANK_STRING_ARRAY, cnames, index, label, values
name
Constructor and Description |
---|
Chooser(java.lang.String name)
Creates a new instance of a chooser widget (used by PCD edit ONLY!).
|
Chooser(java.lang.String name,
java.lang.String label,
PCDSQL choicesql,
int index)
Creates a new instance of chooser widget.
|
Chooser(java.lang.String name,
java.lang.String label,
java.lang.String[] cnames,
java.lang.String[] values,
int index)
Creates a new instance of a chooser widget.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Handles selection changes of the radio buttons.
|
void |
display(java.awt.Container dest,
CloseableWindow window)
Displays the current widget within the container 'dest'.
|
WidgetInstance |
getInstance()
Creates a new widget instance of the widget
A widget instance is an object that stores the value of a widget past
after the widget has been closed.
|
void |
pcdOut(int scope,
java.lang.Appendable out)
Writes the BioPCD representation of the menu widget to a writer object
(see BioLegato's BioPCD editor for more details)
|
void |
setValue(java.lang.String newValue)
Changes the current value for the widget.
|
editWindow, pcdOut
displayEdit, editImage, recursiveDraw
public Chooser(java.lang.String name)
name
- the PCD variable name (this name can be referenced
in the command using the % symbol; for example,
if the name value was set to "A", the value of this
widget could be accessed by using %A% (lower or
upper-case) within the PCD menu command string.public Chooser(java.lang.String name, java.lang.String label, PCDSQL choicesql, int index)
name
- the PCD variable name (this name can be referenced
in the command using the % symbol; for example,
if the name value was set to "A", the value of this
widget could be accessed by using %A% (lower or
upper-case) within the PCD menu command string.label
- the label to display representing the parameter to be
manipulated by the number widget. This is the text the
user will see to the left of the widget in any
BioLegato menu windows.choicesql
- the SQL query to use for obtaining the list widget's
choice values and names.index
- the initial value for the list widget to display
(represents an index within both the 'cnames'
and 'values' arrays)public Chooser(java.lang.String name, java.lang.String label, java.lang.String[] cnames, java.lang.String[] values, int index)
name
- the PCD variable name (this name can be referenced
in the command using the % symbol; for example,
if the name value was set to "A", the value of this
widget could be accessed by using %A% (lower or
upper-case) within the PCD menu command string.label
- the label to display representing the parameter to be
manipulated by the number widget. This is the text the
user will see to the left of the widget in any
BioLegato menu windows.cnames
- the list of names for each option within the list widget
(related to the 'values' method-parameter)values
- the list of values for each option within the list widget
(related to the 'cnames' method-parameter)index
- the initial value for the list widget to display
(represents an index within both the 'cnames'
and 'values' arrays)public void display(java.awt.Container dest, CloseableWindow window)
display
in interface Widget
dest
- the destination Container to display the widget. Note that
this will almost definitely be different from the window
parameter, and in most cases, should be a JPanel object.window
- the parent window to communicate with. The communication
involved is supposed to be limited to just using 'window'
to create modal dialog boxes when necessary (for example,
the AbstractFileChooser's "Browse" file choice dialog box).
Please note that this field may be null!! (e.g. displaying
the current state of the widget in the editor canvas)public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- used to determine which button is selected
(by use of getActionCommand()).public WidgetInstance getInstance()
getInstance
in interface Widget
getInstance
in class ListWidget
public void pcdOut(int scope, java.lang.Appendable out) throws java.io.IOException
pcdOut
in interface Widget
pcdOut
in class SimpleWidget
scope
- the level of scope to write the menu widget. In the case
of PCD, the scope of each line is indicated by the number
of spaced preceding the line. Every 4 spaces count as
one level of scope (any number not divisible by 4 is
considered an error), thus if a line is preceded by 4
spaces, its scope level is considered to be 1out
- the Appendable object to output the BioPCD code.java.io.IOException
public void setValue(java.lang.String newValue)
Changes the current value for the widget. This is used to ensure that any Components that the widget creates for a PCD menu will update the widget object itself. This is important because the widget is expected to store the last value it was set to after a window was closed.
For example, if you opened a PCD menu and set a NumberWidget to 10, and then closed the window, if you reopen the window the NumberWidget should still be 10 (regardless of any default values).
setValue
in interface Widget
setValue
in class ListWidget
newValue
- the new value for the widget.Copyright © 2008-2022 University of Manitoba.