public class AlertBoxCommons<O extends OutputManager<?>> extends java.lang.Object implements ActionListener
AlertBox.| Modifier and Type | Field and Description |
|---|---|
private AlertBox<O> |
alertBox
The related alert box reference.
|
Color |
alertColor
Default color scheme.
|
private Container<O> |
buttonsContainer
The buttons container.
|
int |
buttonSet
The button configuration.
|
java.lang.Object[] |
content
Alert box items.
|
boolean |
forceTitleLeftAlign
Flag indicating the title must be forced to left-align.
|
private boolean |
inputDone
Flag which tracks user input.
|
logical |
result
The variable which is being edited.
|
private java.lang.String |
stack
The Progress stack trace
|
private java.util.concurrent.atomic.AtomicBoolean |
stackTraceActive
Indicates that stack trace dialog is active
|
WidgetFactory<O> |
widgetFactory
Cached widget factory reference.
|
| Constructor and Description |
|---|
AlertBoxCommons(AlertBox<O> alertBox,
Container<O> buttonsContainer,
WidgetFactory<O> widgetFactory,
java.lang.Object[] content,
int buttonSet,
logical var,
Color color,
java.lang.String[] stack)
The default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
buildMessageText()
Builds a multiline string from the alert box content array.
|
private Button<O> |
createButton(java.lang.String text)
Creates and initializes a button widget to be used in the alert box.
|
private Button<O> |
createButton(java.lang.String text,
ActionListener listener)
Creates and initializes a button widget to be used in the alert box.
|
private Button<O> |
createButton(java.lang.String text,
ActionListener listener,
int mnemIdx)
Creates and initializes a button widget to be used in the alert box.
|
private Button<O> |
createButton(java.lang.String text,
int mnemIdx)
Creates and initializes a button widget to be used in the alert box.
|
java.util.List<Button<O>> |
createButtonSet()
Constructs the alert box button set.
|
private Widget<O> |
createSkip(WidgetRegistry<O> registry,
int lines)
Create SKIP(n) widget
|
void |
dismiss()
Set the result code, hide the dialog and flag input as complete.
|
boolean |
findButton(KeyInput keyEvent)
Find the button that matches a passed key event.
|
int |
getDefaultButton()
Returns the index of the default button.
|
logical |
getResult()
Helper method to get the edited result when finished.
|
boolean |
isDismissed()
Returns
true when the modal UI element has dismissed (finished its modal input). |
void |
nextFocus()
Move the input focus to the first widget which can receive a focus in
the peer container.
|
void |
onAction(ActionEvent action)
Action handler to process the AlertBox buttons event.
|
void |
prevFocus()
Move the input focus to the last widget which can receive a focus in
the peer container.
|
void |
setResult(logical value)
Sets the alert-box result value.
|
private void |
showStackTrace()
Display dialog with the Progress stack trace
|
public java.lang.Object[] content
public Color alertColor
public logical result
public int buttonSet
public boolean forceTitleLeftAlign
public WidgetFactory<O extends OutputManager<?>> widgetFactory
private boolean inputDone
private AlertBox<O extends OutputManager<?>> alertBox
private Container<O extends OutputManager<?>> buttonsContainer
private final java.lang.String stack
private final java.util.concurrent.atomic.AtomicBoolean stackTraceActive
public AlertBoxCommons(AlertBox<O> alertBox, Container<O> buttonsContainer, WidgetFactory<O> widgetFactory, java.lang.Object[] content, int buttonSet, logical var, Color color, java.lang.String[] stack)
alertBox - The owner instance.buttonsContainer - The buttons container.widgetFactory - Reference to widget factory.content - Array of elements which form alert box content.buttonSet - Button set type to be constructed for this AlertBox.var - The variable to be edited. The initial value sets the
default button and the resulting value is changed by the
user's press of a button.color - Color scheme to use.stack - Progress stack tracepublic void onAction(ActionEvent action)
onAction in interface ActionListeneraction - The action event to handle is coming from defined buttons.public void dismiss()
public logical getResult()
public void setResult(logical value)
value - The result logical value.public boolean isDismissed()
true when the modal UI element has dismissed (finished its modal input).public java.util.List<Button<O>> createButtonSet()
logical variable being edited determines the default
button (true == the first button, false
== the second button and for a 3-button dialog, unknown ==
the third button).public int getDefaultButton()
createButtonSet().public void nextFocus()
public void prevFocus()
public boolean findButton(KeyInput keyEvent)
keyEvent - Event to check.true if matching button is found and event is
processed.public java.lang.String buildMessageText()
private void showStackTrace()
private Widget<O> createSkip(WidgetRegistry<O> registry, int lines)
registry - widget registrylines - lines to skipprivate Button<O> createButton(java.lang.String text, ActionListener listener)
text - The button's labellistener - The button's action listenerButton instance.private Button<O> createButton(java.lang.String text, ActionListener listener, int mnemIdx)
text - The button's labellistener - The button's action listenermnemIdx - The mnemonic index within its label; if its value is negative, then the button
doesn't have a mnemonic key.Button instance.private Button<O> createButton(java.lang.String text, int mnemIdx)
text - The button's labelmnemIdx - The mnemonic index within its label; if its value is negative, then the button
doesn't use a mnemonic.Button instance.