Top Description Fields Constructors Methods
com.dlsc.preferencesfx.view

public Class CategoryController

extends ScrollPane
Class Inheritance
Static Imports
com.dlsc.preferencesfx.util.Constants.SCROLLBAR_SUBTRACT

Acts as a proxy for the CategoryViews. Can be used to switch between different categories, which will be displayed in this view.
Authors
François Martin, Marco Sanfratello

Field Summary

Modifier and TypeField and Description
private ObjectProperty<CategoryPresenter>
private ObjectProperty<CategoryView>
private static final Logger
private HashMap<Category, CategoryPresenter>
private HashMap<Category, CategoryView>

Constructor Summary

AccessConstructor and Description
public
CategoryController()

Initializes the category controller.

Method Summary

Modifier and TypeMethod and Description
public void
addListener(ReadOnlyObjectProperty<Category>
with category to be listened for
categoryProperty
)

Sets the view according to the current category in categoryProperty.

public void
addView(Category
of the categoryView
category
,
CategoryView
the view to add to the map
view
,
CategoryPresenter
the presenter to add to the map
presenter
)

Adds a view / presenter pair to the respective HashMaps.

public ReadOnlyObjectProperty<CategoryPresenter>
public ReadOnlyObjectProperty<CategoryView>
public CategoryPresenter
public CategoryView
public CategoryPresenter

Returns:

presenter object
getPresenter
(Category
of the view / presenter
category
)

Returns an already loaded presenter.

public boolean

Returns:

true if successfully loaded, false if view is nonexistent
setView
(final Category
of the categoryView that will be set
category
)

Sets the current view to the one of the respective category.

public boolean

Returns:

true if the view and presenter were unloaded and false if view doesn't exist.
unloadView
(Category
of the view / presenter pair to be unloaded.
category
)

Unloads a view / presenter pair from the HashMaps.

Inherited from javafx.scene.control.ScrollPane:
contentPropertycreateDefaultSkinfitToHeightPropertyfitToWidthPropertygetClassCssMetaDatagetContentgetControlCssMetaDatagetHbarPolicygetHmaxgetHmingetHvaluegetInitialFocusTraversablegetMinViewportHeightgetMinViewportWidthgetPrefViewportHeightgetPrefViewportWidthgetVbarPolicygetViewportBoundsgetVmaxgetVmingetVvaluehbarPolicyPropertyhmaxPropertyhminPropertyhvaluePropertyisFitToHeightisFitToWidthisPannableminViewportHeightPropertyminViewportWidthPropertypannablePropertyprefViewportHeightPropertyprefViewportWidthPropertyqueryAccessibleAttributesetContentsetFitToHeightsetFitToWidthsetHbarPolicysetHmaxsetHminsetHvaluesetMinViewportHeightsetMinViewportWidthsetPannablesetPrefViewportHeightsetPrefViewportWidthsetVbarPolicysetViewportBoundssetVmaxsetVminsetVvaluevbarPolicyPropertyviewportBoundsPropertyvmaxPropertyvminPropertyvvalueProperty

Field Detail

displayedCategoryPresenterback to summary
private ObjectProperty<CategoryPresenter> displayedCategoryPresenter
displayedCategoryViewback to summary
private ObjectProperty<CategoryView> displayedCategoryView
LOGGERback to summary
private static final Logger LOGGER
presentersback to summary
private HashMap<Category, CategoryPresenter> presenters
viewsback to summary
private HashMap<Category, CategoryView> views

Constructor Detail

CategoryControllerback to summary
public CategoryController()

Initializes the category controller.

Method Detail

addListenerback to summary
public void addListener(ReadOnlyObjectProperty<Category> categoryProperty)

Sets the view according to the current category in categoryProperty. Must ensure that the category is already loaded, else it will fail.

Parameters
categoryProperty:ReadOnlyObjectProperty<Category>

with category to be listened for

addViewback to summary
public void addView(Category category, CategoryView view, CategoryPresenter presenter)

Adds a view / presenter pair to the respective HashMaps.

Parameters
category:Category

of the categoryView

view:CategoryView

the view to add to the map

presenter:CategoryPresenter

the presenter to add to the map

displayedCategoryPresenterPropertyback to summary
public ReadOnlyObjectProperty<CategoryPresenter> displayedCategoryPresenterProperty()
displayedCategoryViewPropertyback to summary
public ReadOnlyObjectProperty<CategoryView> displayedCategoryViewProperty()
getDisplayedCategoryPresenterback to summary
public CategoryPresenter getDisplayedCategoryPresenter()
getDisplayedCategoryViewback to summary
public CategoryView getDisplayedCategoryView()
getPresenterback to summary
public CategoryPresenter getPresenter(Category category)

Returns an already loaded presenter.

Parameters
category:Category

of the view / presenter

Returns:CategoryPresenter

presenter object

setViewback to summary
public boolean setView(final Category category)

Sets the current view to the one of the respective category. This method can be called in the presenter to switch to a different CategoryView. Controls the way views are being transitioned from one to another.

Parameters
category:Category

of the categoryView that will be set

Returns:boolean

true if successfully loaded, false if view is nonexistent

unloadViewback to summary
public boolean unloadView(Category category)

Unloads a view / presenter pair from the HashMaps. This method can be used in case a view / presenter pair needs to be reloaded.

Parameters
category:Category

of the view / presenter pair to be unloaded.

Returns:boolean

true if the view and presenter were unloaded and false if view doesn't exist.