Class DialogHelper
Helper class for showing dialogs and views from the viewmodel without violating the MVVM pattern. Every class inheriting ViewModelBase has an instance of the DialogHelper.
Inheritance
Inherited Members
Namespace:
Assembly: .dll
Syntax
public class DialogHelper
Constructors
DialogHelper()
Declaration
public DialogHelper()
Methods
showConfirmationDialog(String contentText, String title)
Shows a confirmation dialog with an OK and CANCEL button.
Declaration
public boolean showConfirmationDialog(String contentText, String title)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | contentText | The message for the user |
java.lang.String | title | The title of the dialog |
Returns
Type | Description |
---|---|
boolean | True of OK was pressed |
showError(String message)
Shows a small error dialog.
Declaration
public void showError(String message)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | message | The message to display |
showFileDialog(String directoryPath, Map<String,String> allowedExtensions, String title)
Shows a file selection dialog.
Declaration
public List<File> showFileDialog(String directoryPath, Map<String,String> allowedExtensions, String title)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | directoryPath | The path from at which to launch the file dialog |
java.util.Map<java.lang.String,java.lang.String> | allowedExtensions | The allowed extensions |
java.lang.String | title | The title of the dialog |
Returns
Type | Description |
---|---|
java.util.List<java.io.File> | A list of the selected files |
showInfo(String message)
Shows a small info dialog.
Declaration
public void showInfo(String message)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | message | The message to display |
showInputDialog(String contentText, String defaultValue, String title)
Shows a dialog with a single Text input field.
Declaration
public String showInputDialog(String contentText, String defaultValue, String title)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | contentText | The contentText describing the text field |
java.lang.String | defaultValue | The default value of the text fieldk |
java.lang.String | title | The title of the dialog |
Returns
Type | Description |
---|---|
java.lang.String | The text field value if OK pressed, "" else |
showMessageDialog(Alert.AlertType type, String contentText, String title)
Shows a small dialog of the given type.
Declaration
public static void showMessageDialog(Alert.AlertType type, String contentText, String title)
Parameters
Type | Name | Description |
---|---|---|
javafx.scene.control.Alert.AlertType | type | The type of the dialog. |
java.lang.String | contentText | The contentText |
java.lang.String | title | The title of the dialog |
showView(ShowViewConfiguration configuration, Scope[] scopes)
Creates a new stage and shows the view given in the configuration. Additionally, scopes may be provided. If the views viewmodel use the @InjectScope annotation of MvvmFx, the passed instances will be injected.
Declaration
public void showView(ShowViewConfiguration configuration, Scope[] scopes)
Parameters
Type | Name | Description |
---|---|---|
ShowViewConfiguration | configuration | The configuration based on which the view will be loaded |
de.saxsys.mvvmfx.Scope[] | scopes | The scopes to provide |
showView(ShowViewConfiguration configuration, ViewModel viewModel, Scope[] scopes)
Creates a new stage and shows the view given in the configuration. Additionally, a viewmodel aswell as scopes may be provided. If the view or its viewmodel use the @InjectViewModel or @InjectScope annotation of MvvmFx, the passed instances will be injected.
Declaration
public void showView(ShowViewConfiguration configuration, ViewModel viewModel, Scope[] scopes)
Parameters
Type | Name | Description |
---|---|---|
ShowViewConfiguration | configuration | The configuration based on which the view will be loaded |
de.saxsys.mvvmfx.ViewModel | viewModel | The viewmodel to provide |
de.saxsys.mvvmfx.Scope[] | scopes | The scopes to provide |
showWarning(String message)
Shows a small warning dialog.
Declaration
public void showWarning(String message)
Parameters
Type | Name | Description |
---|---|---|
java.lang.String | message | The message to display |