Top Description Constructors Methods
com.dlsc.preferencesfx.util

public Class PreferencesFxUtils

extends Object
Class Inheritance
Static Imports
com.dlsc.preferencesfx.util.Strings.containsIgnoreCase

Provides utility methods to do general transformations between different model objects of PreferencesFX and or lists and maps of them.
Authors
François Martin, Marco Sanfratello

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static List<Element<E extends Element<E>>>

Returns:

all elements of the categories
categoriesToElements
(List<Category>
the categories to fetch the elements from
categories
)

Returns a list of all the settings which are contained in a list of categories recursively.

public static List<Group>

Returns:

all groups of the categories
categoriesToGroups
(List<Category>
the categories to fetch the groups from
categories
)

Returns a list of all the groups which are contained in a list of categories recursively.

public static List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>>

Returns:

all settings of the categories
categoriesToSettings
(List<Category>
the categories to fetch the settings from
categories
)

Returns a list of all the settings which are contained in a list of categories recursively.

public static List<Category>

Returns:

a list of categories, containing (ignoring case) the given description
filterCategoriesByDescription
(List<Category>
the list of categories to be filtered
categories
,
String
to be searched for
description
)

Filters a list of categories by a given description.

public static List<Group>

Returns:

a list of groups, containing (ignoring case) the given description
filterGroupsByDescription
(List<Group>
the list of groups to be filtered
groups
,
String
to be searched for
description
)

Filters a list of groups by a given description.

public static List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>>

Returns:

a list of settings, containing (ignoring case) the given description
filterSettingsByDescription
(List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>>
the list of settings to be filtered
settings
,
String
to be searched for
description
)

Filters a list of settings by a given description.

public static List<Category>

Returns:

list of all parent categories and respective recursive children categories
flattenCategories
(List<Category>
list of parent categories
categoryLst
)

Puts all categories and their respective children recursively flattened into a list.

private static void
flattenCategories(List<Category>
list to which the categories for the flattened list should be added
flatList
,
List<Category>
list of parent categories to go through recursively
categories
)

Goes through the list of parent categories and adds each category it visists to the flatList.

public static int

Returns:

the number of rows in the grid pane or -1 to indicate no children in the grid pane
getRowCount
(GridPane
the grid pane to count the rows in
gridPane
)

Returns the amount of rows of a given gridPane, if present, -1 else.

public static List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>>

Returns:

all settings of the groups
groupsToSettings
(List<Group>
the groups to fetch the settings from
groups
)

Returns a list of all the settings which are contained in a list of groups recursively.

public static HashMap<Group, Category>

Returns:

a HashMap containing Group, mapped to their corresponding Category
mapGroupsToCategories
(List<Category>
the categories of which to create a map of
categories
)

Creates a map which links Group to Category in a list of categories.

public static HashMap<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>, Category>

Returns:

a HashMap containing Setting, mapped to their corresponding Category
mapSettingsToCategories
(List<Category>
the categories of which to create a map of
categories
)

Creates a map which links Setting to Category in a list of categories.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PreferencesFxUtilsback to summary
public PreferencesFxUtils()

Method Detail

categoriesToElementsback to summary
public static List<Element<E extends Element<E>>> categoriesToElements(List<Category> categories)

Returns a list of all the settings which are contained in a list of categories recursively.

Parameters
categories:List<Category>

the categories to fetch the elements from

Returns:List<Element<E extends Element<E>>>

all elements of the categories

categoriesToGroupsback to summary
public static List<Group> categoriesToGroups(List<Category> categories)

Returns a list of all the groups which are contained in a list of categories recursively.

Parameters
categories:List<Category>

the categories to fetch the groups from

Returns:List<Group>

all groups of the categories

categoriesToSettingsback to summary
public static List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>> categoriesToSettings(List<Category> categories)

Returns a list of all the settings which are contained in a list of categories recursively.

Parameters
categories:List<Category>

the categories to fetch the settings from

Returns:List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>>

all settings of the categories

filterCategoriesByDescriptionback to summary
public static List<Category> filterCategoriesByDescription(List<Category> categories, String description)

Filters a list of categories by a given description.

Parameters
categories:List<Category>

the list of categories to be filtered

description:String

to be searched for

Returns:List<Category>

a list of categories, containing (ignoring case) the given description

filterGroupsByDescriptionback to summary
public static List<Group> filterGroupsByDescription(List<Group> groups, String description)

Filters a list of groups by a given description.

Parameters
groups:List<Group>

the list of groups to be filtered

description:String

to be searched for

Returns:List<Group>

a list of groups, containing (ignoring case) the given description

filterSettingsByDescriptionback to summary
public static List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>> filterSettingsByDescription(List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>> settings, String description)

Filters a list of settings by a given description.

Parameters
settings:List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>>

the list of settings to be filtered

description:String

to be searched for

Returns:List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>>

a list of settings, containing (ignoring case) the given description

flattenCategoriesback to summary
public static List<Category> flattenCategories(List<Category> categoryLst)

Puts all categories and their respective children recursively flattened into a list.

Parameters
categoryLst:List<Category>

list of parent categories

Returns:List<Category>

list of all parent categories and respective recursive children categories

flattenCategoriesback to summary
private static void flattenCategories(List<Category> flatList, List<Category> categories)

Goes through the list of parent categories and adds each category it visists to the flatList.

Implementation Note

Internal helper method for PreferencesFxUtils#flattenCategories(List).

Parameters
flatList:List<Category>

list to which the categories for the flattened list should be added

categories:List<Category>

list of parent categories to go through recursively

getRowCountback to summary
public static int getRowCount(GridPane gridPane)

Returns the amount of rows of a given gridPane, if present, -1 else.

Parameters
gridPane:GridPane

the grid pane to count the rows in

Returns:int

the number of rows in the grid pane or -1 to indicate no children in the grid pane

groupsToSettingsback to summary
public static List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>> groupsToSettings(List<Group> groups)

Returns a list of all the settings which are contained in a list of groups recursively.

Parameters
groups:List<Group>

the groups to fetch the settings from

Returns:List<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>>

all settings of the groups

mapGroupsToCategoriesback to summary
public static HashMap<Group, Category> mapGroupsToCategories(List<Category> categories)

Creates a map which links Group to Category in a list of categories.

API Note

does not flatten the categories

Parameters
categories:List<Category>

the categories of which to create a map of

Returns:HashMap<Group, Category>

a HashMap containing Group, mapped to their corresponding Category

mapSettingsToCategoriesback to summary
public static HashMap<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>, Category> mapSettingsToCategories(List<Category> categories)

Creates a map which links Setting to Category in a list of categories.

API Note

does not flatten the categories

Parameters
categories:List<Category>

the categories of which to create a map of

Returns:HashMap<Setting<E extends Element<E extends Element<E>>, P extends Property<T>>, Category>

a HashMap containing Setting, mapped to their corresponding Category