public class ChoiceList extends ListWidget
Modifier and Type | Field and Description |
---|---|
protected javax.swing.JList |
choice_list
The list containing the data.
|
static javax.swing.Icon |
WIDGET_ICON
The icon for the widget
|
BLANK_STRING_ARRAY, cnames, index, label, values
name
Constructor and Description |
---|
ChoiceList(java.lang.String name)
Creates a new instance of a choice list widget
(this specific constructor is used by the PCD editor ONLY!).
|
ChoiceList(java.lang.String name,
java.lang.String label,
PCDSQL choicesql,
int index)
Creates a new instance of choice list widget.
|
ChoiceList(java.lang.String name,
java.lang.String label,
java.lang.String[] cnames,
java.lang.String[] values,
int index)
Creates a new instance of ChoiceList
(represents "choice_list" in GDE menu files).
|
Modifier and Type | Method and Description |
---|---|
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
protected transient javax.swing.JList choice_list
public static final javax.swing.Icon WIDGET_ICON
public ChoiceList(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 ChoiceList(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 ChoiceList(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)
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 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.