ChoiceDialog

class ChoiceDialog[T](val delegate: ChoiceDialog[T]) extends Dialog[T] with SFXDelegate[ChoiceDialog[T]]

A dialog that shows a list of choices to the user, from which they can pick one item at most.

A dialog that shows a list of choices to the user, from which they can pick one item at most.

Wraps a JavaFX https://docs.oracle.com/javase/8/javafx/api/javafx/scalafx.scene.control/ChoiceDialog.html ChoiceDialog.

Type Params
T

The type of the items to show to the user, and the type that is returned via result when the dialog is dismissed.

Constructor

Creates a default, empty instance of ChoiceDialog with no set items and a null default choice. Users of this constructor will subsequently need to call items to specify which items to show to the user.

See also

Dialog

Companion
object
class Dialog[T]
trait SFXDelegate[ChoiceDialog[T]]
class Object
trait Matchable
class Any

Value members

Constructors

def this(defaultChoice: T, choices: Iterable[T])

Creates a new ChoiceDialog instance with the first argument specifying the default choice that should be shown to the user, and the second argument specifying a collection of all available choices for the user. It is expected that the defaultChoice be one of the elements in the choices collection. If this is not true, then defaultChoice will be set to null and the dialog will show with the initial choice set to the first item in the list of choices.

Creates a new ChoiceDialog instance with the first argument specifying the default choice that should be shown to the user, and the second argument specifying a collection of all available choices for the user. It is expected that the defaultChoice be one of the elements in the choices collection. If this is not true, then defaultChoice will be set to null and the dialog will show with the initial choice set to the first item in the list of choices.

Value Params
choices

All possible choices to present to the user.

defaultChoice

The item to display as the pre-selected choice in the dialog. This item must be contained within the choices varargs array.

Concrete methods

Returns the default choice that was specified in the constructor.

Returns the default choice that was specified in the constructor.

Returns the buffer of all items that will be displayed to users. This buffer can be modified by the developer to add, remove, or reorder the items to present to the user.

Returns the buffer of all items that will be displayed to users. This buffer can be modified by the developer to add, remove, or reorder the items to present to the user.

Returns the property representing the currently selected item in the dialog.

Returns the property representing the currently selected item in the dialog.

def selectedItem_=(item: T): Unit

Sets the currently selected item in the dialog.

Sets the currently selected item in the dialog.

Value Params
item

The item to select in the dialog.

def showAndWait(): Option[T]

Shows the dialog and waits for the user response (in other words, brings up a blocking dialog, with the returned value the users input).

Shows the dialog and waits for the user response (in other words, brings up a blocking dialog, with the returned value the users input).

 dialog.showAndWait()

Or when return value is required:

 val r = dialog.showAndWait()
 r match {
   case Some(v) => ...
   case None    => ...
 }
Returns

An Option that contains the result.

Inherited methods

Construct an event dispatch chain for this target. The event dispatch chain contains event dispatchers which might be interested in processing of events targeted at this EventTarget. This event target is not automatically added to the chain, so if it wants to process events, it needs to add an EventDispatcher for itself to the chain.

Construct an event dispatch chain for this target. The event dispatch chain contains event dispatchers which might be interested in processing of events targeted at this EventTarget. This event target is not automatically added to the chain, so if it wants to process events, it needs to add an EventDispatcher for itself to the chain.

In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target.

The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain.

The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain.

Value Params
tail

the initial chain to build from

Returns

the resulting event dispatch chain for this target

See also
Inherited from
EventTarget

A property representing the content text for the dialog pane. The content text is lower precedence than the scalafx.scene.control.DialogPane.content node, meaning that if both the content node and the contentText properties are set, the content text will not be displayed in a default DialogPane instance.

A property representing the content text for the dialog pane. The content text is lower precedence than the scalafx.scene.control.DialogPane.content node, meaning that if both the content node and the contentText properties are set, the content text will not be displayed in a default DialogPane instance.

See also
Inherited from
Dialog
def contentText_=(value: String): Unit
Inherited from
Dialog
def dialogPane: ObjectProperty[DialogPane]
Inherited from
Dialog
def dialogPane_=(value: DialogPane): Unit
Inherited from
Dialog
override def equals(ref: Any): Boolean

Verifies if a object is equals to this delegate.

Verifies if a object is equals to this delegate.

Value Params
ref

Object to be compared.

Returns

if the other object is equals to this delegate or not.

Definition Classes
Inherited from
SFXDelegate

The dialog graphic, presented either in the header, if one is showing, or to the left of the content.

The dialog graphic, presented either in the header, if one is showing, or to the left of the content.

See also
Inherited from
Dialog
def graphic_=(value: Node): Unit
Inherited from
Dialog
override def hashCode: Int
Returns

The delegate hashcode

Definition Classes
Inherited from
SFXDelegate

A property representing the header text for the dialog pane. The header text is lower precedence than the scalafx.scene.control.DialogPane.header node, meaning that if both the header node and the headerText properties are set, the header text will not be displayed in a default DialogPane instance.

A property representing the header text for the dialog pane. The header text is lower precedence than the scalafx.scene.control.DialogPane.header node, meaning that if both the header node and the headerText properties are set, the header text will not be displayed in a default DialogPane instance.

See also
Inherited from
Dialog
def headerText_=(value: Option[String]): Unit
Inherited from
Dialog
def headerText_=(value: String): Unit
Inherited from
Dialog

Property representing the height of the dialog.

Property representing the height of the dialog.

Inherited from
Dialog
def height_=(h: Double): Unit
Inherited from
Dialog
def initModality(modality: Modality): Unit

Specifies the modality for this dialog. This must be done prior to making the dialog visible. The modality is one of: Modality.NONE, Modality.WINDOW_MODAL, or Modality.APPLICATION_MODAL.

Specifies the modality for this dialog. This must be done prior to making the dialog visible. The modality is one of: Modality.NONE, Modality.WINDOW_MODAL, or Modality.APPLICATION_MODAL.

Value Params
modality

the modality for this dialog.

Throws
IllegalStateException

if this property is set after the dialog has ever been made visible.

Inherited from
Dialog
def initOwner(window: Window): Unit

Specifies the owner Window for this dialog, or null for a top-level, unowned dialog. This must be done prior to making the dialog visible.

Specifies the owner Window for this dialog, or null for a top-level, unowned dialog. This must be done prior to making the dialog visible.

Value Params
window

the owner Window for this dialog.

Throws
IllegalStateException

if this property is set after the dialog has ever been made visible.

Inherited from
Dialog
def initStyle(style: StageStyle): Unit

Specifies the style for this dialog. This must be done prior to making the dialog visible. The style is one of: StageStyle.DECORATED, StageStyle.UNDECORATED, StageStyle.TRANSPARENT, StageStyle.UTILITY, or StageStyle.UNIFIED.

Specifies the style for this dialog. This must be done prior to making the dialog visible. The style is one of: StageStyle.DECORATED, StageStyle.UNDECORATED, StageStyle.TRANSPARENT, StageStyle.UTILITY, or StageStyle.UNIFIED.

Value Params
style

the style for this dialog.

Throws
IllegalStateException

if this property is set after the dialog has ever been made visible.

Inherited from
Dialog

Retrieves the modality attribute for this dialog.

Retrieves the modality attribute for this dialog.

Returns

the modality.

See also
Inherited from
Dialog
def onCloseRequest: ObjectProperty[EventHandler[DialogEvent]]
Inherited from
Dialog
def onCloseRequest_=(v: EventHandler[DialogEvent]): Unit
Inherited from
Dialog
def onHidden: ObjectProperty[EventHandler[DialogEvent]]

Called just after the Dialog has been hidden. When the scalafx.scene.control.Dialog is hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when the scalafx.scene.control.Dialog is closed.

Called just after the Dialog has been hidden. When the scalafx.scene.control.Dialog is hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when the scalafx.scene.control.Dialog is closed.

Inherited from
Dialog
def onHidden_=(v: EventHandler[DialogEvent]): Unit
Inherited from
Dialog
def onHiding: ObjectProperty[EventHandler[DialogEvent]]

Called just prior to the Dialog being hidden.

Called just prior to the Dialog being hidden.

Inherited from
Dialog
def onHiding_=(v: EventHandler[DialogEvent]): Unit
Inherited from
Dialog
def onShowing: ObjectProperty[EventHandler[DialogEvent]]

Called just prior to the Dialog being shown.

Called just prior to the Dialog being shown.

Inherited from
Dialog
def onShowing_=(v: EventHandler[DialogEvent]): Unit
Inherited from
Dialog
def onShown: ObjectProperty[EventHandler[DialogEvent]]

Called just after the Dialog is shown.

Called just after the Dialog is shown.

Inherited from
Dialog
def onShown_=(v: EventHandler[DialogEvent]): Unit
Inherited from
Dialog

Retrieves the owner Window for this dialog, or null for an unowned dialog.

Retrieves the owner Window for this dialog, or null for an unowned dialog.

Returns

the owner Window.

See also
Inherited from
Dialog

Represents whether the dialog is resizable.

Represents whether the dialog is resizable.

Inherited from
Dialog
def resizable_=(v: Boolean): Unit
Inherited from
Dialog

A property representing what has been returned from the dialog. A result is generated through the resultConverter, which is intended to convert from the ButtonType that the user clicked on into a value of type R.

A property representing what has been returned from the dialog. A result is generated through the resultConverter, which is intended to convert from the ButtonType that the user clicked on into a value of type R.

See also
Inherited from
Dialog

API to convert the scalafx.scene.control.ButtonType that the user clicked on into a result that can be returned via the scalafx.scene.control.Dialog.result property. This is necessary as scalafx.scene.control.ButtonType represents the visual button within the dialog, and do not know how to map themselves to a valid result - that is a requirement of the dialog implementation by making use of the result converter. In some cases, the result type of a Dialog subclass is ButtonType (which means that the result converter can be null), but in some cases (where the result type, R, is not ButtonType or Void), this callback must be specified.

API to convert the scalafx.scene.control.ButtonType that the user clicked on into a result that can be returned via the scalafx.scene.control.Dialog.result property. This is necessary as scalafx.scene.control.ButtonType represents the visual button within the dialog, and do not know how to map themselves to a valid result - that is a requirement of the dialog implementation by making use of the result converter. In some cases, the result type of a Dialog subclass is ButtonType (which means that the result converter can be null), but in some cases (where the result type, R, is not ButtonType or Void), this callback must be specified.

Inherited from
Dialog
def resultConverter_=(f: ButtonType => T): Unit
Inherited from
Dialog
def result_=(value: T): Unit
Inherited from
Dialog
def showAndWait[F](j2s: F)(convert: DConvert[T, F]): Option[S]

Shows the dialog and waits for the user response (in other words, brings up a blocking dialog, with the returned value the users input).

Shows the dialog and waits for the user response (in other words, brings up a blocking dialog, with the returned value the users input).

The intended use when return value is ignored:

 dialog.showAndWait()

Or when return value is required:

 val r = dialog.showAndWait()
 r match {
   case Some(v) => ...
   case None => ...
 }
Returns

An Option that contains the result.

See also
Inherited from
Dialog

Represents whether the dialog is currently showing.

Represents whether the dialog is currently showing.

Inherited from
Dialog

Return the title of the dialog.

Return the title of the dialog.

Inherited from
Dialog
def title_=(v: String): Unit
Inherited from
Dialog
override def toString: String
Returns

Returns the original delegate's toString() adding a [SFX] prefix.

Definition Classes
Inherited from
SFXDelegate

Property representing the width of the dialog.

Property representing the width of the dialog.

Inherited from
Dialog
def width_=(w: Double): Unit
Inherited from
Dialog

The horizontal location of this scalafx.scene.control.Dialog. Changing this attribute will move the scalafx.scene.control.Dialog horizontally.

The horizontal location of this scalafx.scene.control.Dialog. Changing this attribute will move the scalafx.scene.control.Dialog horizontally.

Inherited from
Dialog
def x_=(v: Double): Unit
Inherited from
Dialog

The vertical location of this scalafx.scene.control.Dialog. Changing this attribute will move the scalafx.scene.control.Dialog vertically.

The vertical location of this scalafx.scene.control.Dialog. Changing this attribute will move the scalafx.scene.control.Dialog vertically.

Inherited from
Dialog
def y_=(v: Double): Unit
Inherited from
Dialog

Concrete fields

override val delegate: ChoiceDialog[T]