public class JFXDialogFactory extends Object implements DialogFactory
Dialog factory for JavaFX applications. It provides custom dialogs which can be used in DEMUX JavaFX applications. Since JavaFX currently does not have built-in dialogs, this class provides custom dialog implementation.
Note that these dialogs are synchronous, meaning that they will block calling thread until they are closed.
Constructor and Description |
---|
JFXDialogFactory(DMXViewManager manager,
javafx.stage.Stage parent)
Create new instance.
|
Modifier and Type | Method and Description |
---|---|
JFXDialogStage |
createDialog(String viewId,
String title)
Create dialog for JavaFX platform based on provided parameters.
|
JFXOptionStage |
createOptionDialog(String viewId,
String altTitle,
int options,
Object content)
Create options dialog based on specified parameters.
|
JFXOptionStage |
createOptionDialog(String viewId,
String altTitle,
String[] options,
Object content)
Creates options dialog with custom buttons.
|
JFXProgressDialog |
createProgressDialog(String viewId)
Creates dialog that will be used to display task progress.
|
void |
setResourceManager(DMXResourceManager resourceManager)
Sets resource manager.
|
public JFXDialogFactory(DMXViewManager manager, javafx.stage.Stage parent)
manager
- view managerparent
- parent stagepublic void setResourceManager(DMXResourceManager resourceManager)
resourceManager
- resource managerpublic JFXDialogStage createDialog(String viewId, String title)
Create dialog for JavaFX platform based on provided parameters. This
method will show view with specified ID inside a dialog window. Dialog
parameters (title, modality) are drawn from view definitions. Note that
this view should be an instance on DMXDialogView
.
Clients can specify alternate dialog title by parameter title
,
which can be different from title defined within the view. If this
parameter is null
, original title is used.
viewId
- ID of view to display in dialogtitle
- alternate title (different from one definednull
if view with specified ID does
not existpublic JFXOptionStage createOptionDialog(String viewId, String altTitle, int options, Object content)
JOptionPane
.public JFXOptionStage createOptionDialog(String viewId, String altTitle, String[] options, Object content)
Creates options dialog with custom buttons. Buttons text is specified as array in options
parameter. Buttons are laid out in order specified, from left to right. The return value is index of
selected button in options
array. For example, in the following code:
String[] options = {"Option 1", "Option 2", "Option 3"};
If user selected Option 2
, return value is 1 (option index in array).
Parameter viewId
is ID of the view which should be displayed inside dialog. If this parameter is null,
then parameter content
is used as view content.
viewId
- ID of view to displayaltTitle
- alternate titleoptions
- options for dialogcontent
- content to displaypublic JFXProgressDialog createProgressDialog(String viewId)
Creates dialog that will be used to display task progress. Progress display is handled by a view with
specified ID (parameter viewId
).
This kind of dialog is shown automatically on task start, and removed when task is ended.
viewId
- view IDCopyright © 2012-2014 Vektor Software. All Rights Reserved.