Top Description Fields Constructors Methods
com.dlsc.preferencesfx

public Class PreferencesFx

extends Object
Class Inheritance
Imports
com.dlsc.formsfx.model.util.TranslationService, com.dlsc.preferencesfx.history.History, com.dlsc.preferencesfx.model.Category, .PreferencesFxModel, com.dlsc.preferencesfx.util.SearchHandler, .StorageHandler, .StorageHandlerImpl, com.dlsc.preferencesfx.view.BreadCrumbPresenter, .BreadCrumbView, .CategoryController, .CategoryPresenter, .CategoryView, .NavigationPresenter, .NavigationView, .PreferencesFxDialog, .PreferencesFxPresenter, .PreferencesFxView, .UndoRedoBox, javafx.collections.ObservableList, javafx.event.EventHandler, .EventType, javafx.scene.image.Image, org.slf4j.Logger, .LoggerFactory

Represents the main PreferencesFX class.
Authors
François Martin, Marco Sanfratello

Field Summary

Modifier and TypeField and Description
private CategoryController
private static final Logger
private PreferencesFxDialog
private PreferencesFxModel
private PreferencesFxPresenter
private PreferencesFxView
private UndoRedoBox

Constructor Summary

AccessConstructor and Description
private
PreferencesFx(Class<?> saveClass, Category... categories)

private
PreferencesFx(StorageHandler storageHandler, Category... categories)

Method Summary

Modifier and TypeMethod and Description
public PreferencesFx

Returns:

PreferencesFx to allow for chaining.
addEventHandler
(EventType<PreferencesFxEvent>
the type of the events to receive by the handler
eventType
,
EventHandler<? super PreferencesFxEvent>
the handler to register
eventHandler
)

Registers an event handler with the model.

public PreferencesFx
buttonsVisibility(boolean isVisible)

public PreferencesFx

Returns:

this object for fluent API
debugHistoryMode
(boolean
if true, pressing the key combination will open the dialog
debugState
)

Defines whether the table to debug the undo / redo history should be shown in a dialog when pressing a key combination or not.

public PreferencesFx

Returns:

PreferencesFx to allow for chaining.
dialogIcon
(Image
the image to be used as the dialog icon.
image
)

Sets the dialog icon.

public PreferencesFx

Returns:

PreferencesFx to allow for chaining.
dialogTitle
(String
the dialog title
title
)

Sets the dialog title.

public void
discardChanges()

Call this method to undo all changes made in the settings when showing the preferences by using getView().

public ObservableList<String>

Returns:

the stylesheets List of the PreferenceFxDialog
getStylesheets
()

Return the stylesheets of the PreferenceFxDialog.

public PreferencesFxView

Returns:

a PreferencesFxView, so that it can be used as a Node.
getView
()

Returns a PreferencesFxView, so that it can be used as a Node.

public PreferencesFx

Returns:

PreferencesFx to allow for chaining.
i18n
(TranslationService
The new value for the translation service property.
newValue
)

Sets the translation service property of the preferences dialog.

private void
init()

private void
initializeCategoryViews()

Prepares the CategoryController by creating CategoryView / CategoryPresenter pairs from all Categories and loading them into the CategoryController.

public PreferencesFx

Returns:

this object for fluent API
instantPersistent
(boolean
if true, will instantly persist changes
instantPersistent
)

Defines whether changes should be instantly persisted or not.

public boolean

Returns:

true if there are unsaved changed.
isContainingChanges
()

Check if any changes are pending.

public static PreferencesFx

Returns:

the preferences window
of
(Class<?>
the class which the preferences are saved as Must be unique to the application using the preferences
saveClass
,
Category...
the items to be displayed in the TreeSearchView
categories
)

Creates the Preferences window.

public static PreferencesFx

Returns:

the preferences window
of
(StorageHandler
Custom implementation of the StorageHandler
customStorageHandler
,
Category...
the items to be displayed in the TreeSearchView
categories
)

Creates the Preferences window.

public PreferencesFx

Returns:

this object for fluent API
persistApplicationState
(boolean
if true, the storing of the window state of the dialog window and the settings values are enabled.
enable
)

Defines if the PreferencesAPI should save the applications states.

public PreferencesFx

Returns:

this object for fluent API
persistWindowState
(boolean
if true, the size, position and last selected item in the TreeSearchView are being saved. When the dialog is showed again, it will be restored to the last saved state. Defaults to false.
persist
)

Defines whether the state of the dialog window should be persisted or not.

public PreferencesFx

Returns:

PreferencesFx to allow for chaining.
removeEventHandler
(EventType<PreferencesFxEvent>
the event type from which to unregister
eventType
,
EventHandler<? super PreferencesFxEvent>
the handler to unregister
eventHandler
)

Unregisters a previously registered event handler from the model.

public PreferencesFx

Returns:

this object for fluent API
saveSettings
(boolean
if true, the values of all settings of the application are saved. When the application is started again, the settings values will be restored to the last saved state. Defaults to true.
save
)

Defines whether the adjusted settings of the application should be saved or not.

public void
saveSettings()

Call this method to manually save the changed settings when showing the preferences by using getView().

public void
show()

Shows the PreferencesFX dialog.

public void
show(boolean
window or not modal, that's the question.
modal
)

Show the PreferencesFX dialog.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

categoryControllerback to summary
private CategoryController categoryController
LOGGERback to summary
private static final Logger LOGGER
preferencesFxDialogback to summary
private PreferencesFxDialog preferencesFxDialog
preferencesFxModelback to summary
private PreferencesFxModel preferencesFxModel
preferencesFxPresenterback to summary
private PreferencesFxPresenter preferencesFxPresenter
preferencesFxViewback to summary
private PreferencesFxView preferencesFxView
undoRedoBoxback to summary
private UndoRedoBox undoRedoBox

Constructor Detail

PreferencesFxback to summary
private PreferencesFx(Class<?> saveClass, Category... categories)
PreferencesFxback to summary
private PreferencesFx(StorageHandler storageHandler, Category... categories)

Method Detail

addEventHandlerback to summary
public PreferencesFx addEventHandler(EventType<PreferencesFxEvent> eventType, EventHandler<? super PreferencesFxEvent> eventHandler)

Registers an event handler with the model. The handler is called when the model receives an Event of the specified type during the bubbling phase of event delivery.

Parameters
eventType:EventType<PreferencesFxEvent>

the type of the events to receive by the handler

eventHandler:EventHandler<? super PreferencesFxEvent>

the handler to register

Returns:PreferencesFx

PreferencesFx to allow for chaining.

Exceptions
NullPointerException:
if either event type or handler are null.
buttonsVisibilityback to summary
public PreferencesFx buttonsVisibility(boolean isVisible)
debugHistoryModeback to summary
public PreferencesFx debugHistoryMode(boolean debugState)

Defines whether the table to debug the undo / redo history should be shown in a dialog when pressing a key combination or not.
Pressing Ctrl + Shift + H (Windows) or CMD + Shift + H (Mac) opens a dialog with the undo / redo history, shown in a table.

Parameters
debugState:boolean

if true, pressing the key combination will open the dialog

Returns:PreferencesFx

this object for fluent API

dialogIconback to summary
public PreferencesFx dialogIcon(Image image)

Sets the dialog icon.

Parameters
image:Image

the image to be used as the dialog icon.

Returns:PreferencesFx

PreferencesFx to allow for chaining.

dialogTitleback to summary
public PreferencesFx dialogTitle(String title)

Sets the dialog title.

Parameters
title:String

the dialog title

Returns:PreferencesFx

PreferencesFx to allow for chaining.

discardChangesback to summary
public void discardChanges()

Call this method to undo all changes made in the settings when showing the preferences by using getView().

getStylesheetsback to summary
public ObservableList<String> getStylesheets()

Return the stylesheets of the PreferenceFxDialog.

Returns:ObservableList<String>

the stylesheets List of the PreferenceFxDialog

getViewback to summary
public PreferencesFxView getView()

Returns a PreferencesFxView, so that it can be used as a Node.

Returns:PreferencesFxView

a PreferencesFxView, so that it can be used as a Node.

i18nback to summary
public PreferencesFx i18n(TranslationService newValue)

Sets the translation service property of the preferences dialog.

Parameters
newValue:TranslationService

The new value for the translation service property.

Returns:PreferencesFx

PreferencesFx to allow for chaining.

initback to summary
private void init()
initializeCategoryViewsback to summary
private void initializeCategoryViews()

Prepares the CategoryController by creating CategoryView / CategoryPresenter pairs from all Categories and loading them into the CategoryController.

instantPersistentback to summary
public PreferencesFx instantPersistent(boolean instantPersistent)

Defines whether changes should be instantly persisted or not. When instantPersistent is false, call saveSettings() to apply the changes.

Parameters
instantPersistent:boolean

if true, will instantly persist changes

Returns:PreferencesFx

this object for fluent API

isContainingChangesback to summary
public boolean isContainingChanges()

Check if any changes are pending. Useful when manually saving settings.

Returns:boolean

true if there are unsaved changed.

ofback to summary
public static PreferencesFx of(Class<?> saveClass, Category... categories)

Creates the Preferences window.

Parameters
saveClass:Class<?>

the class which the preferences are saved as Must be unique to the application using the preferences

categories:Category[]

the items to be displayed in the TreeSearchView

Returns:PreferencesFx

the preferences window

ofback to summary
public static PreferencesFx of(StorageHandler customStorageHandler, Category... categories)

Creates the Preferences window.

Parameters
customStorageHandler:StorageHandler

Custom implementation of the StorageHandler

categories:Category[]

the items to be displayed in the TreeSearchView

Returns:PreferencesFx

the preferences window

persistApplicationStateback to summary
public PreferencesFx persistApplicationState(boolean enable)

Defines if the PreferencesAPI should save the applications states. This includes the persistence of the dialog window, as well as each settings values.

Parameters
enable:boolean

if true, the storing of the window state of the dialog window and the settings values are enabled.

Returns:PreferencesFx

this object for fluent API

persistWindowStateback to summary
public PreferencesFx persistWindowState(boolean persist)

Defines whether the state of the dialog window should be persisted or not.

Parameters
persist:boolean

if true, the size, position and last selected item in the TreeSearchView are being saved. When the dialog is showed again, it will be restored to the last saved state. Defaults to false.

Returns:PreferencesFx

this object for fluent API

removeEventHandlerback to summary
public PreferencesFx removeEventHandler(EventType<PreferencesFxEvent> eventType, EventHandler<? super PreferencesFxEvent> eventHandler)

Unregisters a previously registered event handler from the model. One handler might have been registered for different event types, so the caller needs to specify the particular event type from which to unregister the handler.

Parameters
eventType:EventType<PreferencesFxEvent>

the event type from which to unregister

eventHandler:EventHandler<? super PreferencesFxEvent>

the handler to unregister

Returns:PreferencesFx

PreferencesFx to allow for chaining.

Exceptions
NullPointerException:
if either event type or handler are null.
saveSettingsback to summary
public PreferencesFx saveSettings(boolean save)

Defines whether the adjusted settings of the application should be saved or not.

Parameters
save:boolean

if true, the values of all settings of the application are saved. When the application is started again, the settings values will be restored to the last saved state. Defaults to true.

Returns:PreferencesFx

this object for fluent API

saveSettingsback to summary
public void saveSettings()

Call this method to manually save the changed settings when showing the preferences by using getView().

showback to summary
public void show()

Shows the PreferencesFX dialog.

showback to summary
public void show(boolean modal)

Show the PreferencesFX dialog.

Parameters
modal:boolean

window or not modal, that's the question.