public class Facet extends Object
Constructor and Description |
---|
Facet(String title,
String field,
String value,
sirius.kernel.cache.ValueComputer<String,String> translator)
Creates a new faced with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
<E extends Enum<E>> |
addEnumItem(Class<E> enumClass)
Adds the enum constants of the given enum to the facet.
|
Facet |
addItem(String key,
String title,
int count)
Adds a facet item
|
Facet |
addItems(Iterable<String> items)
Adds the given collections of items.
|
String |
createToggleQueryString(FacetItem item)
Creates a query string which can be appended to a link in order to toggle the given item.
|
List<FacetItem> |
getHiddenItems()
Returns all hidden items collected for this facet.
|
List<FacetItem> |
getItems()
Returns all visible items collected for this facet.
|
int |
getMaxVisibleFacetItems()
Returns the maximum number of items that should be visible.
|
String |
getName()
Returns the name of this facet.
|
FacetRange |
getRange()
Returns the used facet range.
|
String |
getTitle()
Returns the title of this fact.
|
String |
getValue()
Returns the selected value.
|
boolean |
hasHiddenItems()
Determines if this facet has at least one hidden item
|
boolean |
hasItems()
Determines if this facet has at least one item
|
boolean |
hasRange()
Determines if this facet has a range for filtering values.
|
boolean |
isFacetCollapsingEnabled()
Determines if collapsing is enabled for this facet.
|
Facet |
withFacetCollapsingEnabled(boolean facetCollapsingEnabled)
Enables or disables collapsing for this facet.
|
Facet |
withMaxVisibleFacetItems(int maxVisibleFacetItems)
Sets the number of visible facet items.
|
Facet |
withRange(FacetRange facetRange)
Specifies the facet range to use for this facet.
|
Facet |
withValue(String value)
Specifies the value used for this facet.
|
Facet |
withValues(List<String> values)
Specifies the values used for this facet.
|
protected Page<?> parent
public Facet(String title, String field, @Nullable String value, @Nullable sirius.kernel.cache.ValueComputer<String,String> translator)
title
- the visible name of the facetfield
- the internal name of the facetvalue
- the selected valuetranslator
- the translator which provides "official" labels for filter values.public List<FacetItem> getItems()
public List<FacetItem> getHiddenItems()
public String createToggleQueryString(FacetItem item)
item
- the item to togglepublic String getName()
public String getTitle()
public String getValue()
public Facet addItem(String key, String title, int count)
key
- the filter value of the itemtitle
- the public visible name of the itemcount
- the number of matched for this itempublic Facet addItems(Iterable<String> items)
items
- the items to addpublic <E extends Enum<E>> Facet addEnumItem(Class<E> enumClass)
E
- the type of the enumenumClass
- the enum class which constants are to be addedpublic Facet withFacetCollapsingEnabled(boolean facetCollapsingEnabled)
facetCollapsingEnabled
- true to enable facet collapsing, false otherwisepublic boolean isFacetCollapsingEnabled()
public Facet withMaxVisibleFacetItems(int maxVisibleFacetItems)
maxVisibleFacetItems
- the number of visible facet itemspublic int getMaxVisibleFacetItems()
public boolean hasItems()
public boolean hasHiddenItems()
public Facet withValue(String value)
value
- the active filter value of this facetpublic Facet withValues(List<String> values)
values
- the active filter values of this facetpublic FacetRange getRange()
public Facet withRange(FacetRange facetRange)
facetRange
- the facet range to usepublic boolean hasRange()
Copyright © 2018. All rights reserved.