Class BreadcrumbBarModel<T>
java.lang.Object
org.pushingpixels.flamingo.api.bcb.BreadcrumbBarModel<T>
- Type Parameters:
T
- Type of data associated with each breadcrumb bar item.
Model for the breadcrumb bar component (
JBreadcrumbBar
).-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Indication whether the model is in cumulative mode.protected EventListenerList
Listener list.protected int
Smallest index of path change since the last call tosetCumulative(boolean)
withtrue
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLast
(BreadcrumbItem<T> item) Adds the specified item at the end of the path.void
Adds the specified path listener to this model.protected void
firePathChanged
(int indexOfFirstChange) Fires aBreadcrumbPathEvent
.getItem
(int index) Returns the model item at the specified index.int
Returns the number of items in this model.getItems()
Returns an unmodifiable list of the items in this model.int
indexOf
(BreadcrumbItem<T> item) Returns the index of the specified item.void
Removes the last item in this model.void
Removes the specified path listener from this model.void
replace
(List<BreadcrumbItem<T>> items) Replaces the current item list with the specified list.void
reset()
Resets this model, removing all the items.void
setCumulative
(boolean isCumulative) Starts or ends the cumulative mode.
-
Field Details
-
listenerList
Listener list. -
isCumulative
protected boolean isCumulativeIndication whether the model is in cumulative mode.- See Also:
-
smallestCumulativeIndex
protected int smallestCumulativeIndexSmallest index of path change since the last call tosetCumulative(boolean)
withtrue
.
-
-
Constructor Details
-
BreadcrumbBarModel
public BreadcrumbBarModel()Creates a new empty model.
-
-
Method Details
-
indexOf
Returns the index of the specified item.- Parameters:
item
- Item.- Returns:
- Index of the item if it is in the model or -1 if it is not.
-
removeLast
public void removeLast()Removes the last item in this model. -
reset
public void reset()Resets this model, removing all the items. -
getItems
Returns an unmodifiable list of the items in this model.- Returns:
- Unmodifiable list of the items in this model.
-
getItemCount
public int getItemCount()Returns the number of items in this model.- Returns:
- Number of items in this model.
-
getItem
Returns the model item at the specified index.- Parameters:
index
- Item index.- Returns:
- The model item at the specified index. Will return
null
if the index is negative or larger than the number of items.
-
replace
Replaces the current item list with the specified list.- Parameters:
items
- New contents of the model.
-
addLast
Adds the specified item at the end of the path.- Parameters:
item
- Item to add.
-
setCumulative
public void setCumulative(boolean isCumulative) Starts or ends the cumulative mode. In cumulative mode calls toaddLast(BreadcrumbItem)
,removeLast()
,replace(List)
andreset()
will not fire events on the listeners registered withaddPathListener(BreadcrumbPathListener)
.- Parameters:
isCumulative
- Iftrue
, the model enters cumulative mode. Iffalse
, the model exist cumulative mode and fires a path event on all registered listeners with the smallest index of all changes that have happened since the last time this method was called withtrue
.
-
addPathListener
Adds the specified path listener to this model.- Parameters:
l
- Path listener to add.
-
removePathListener
Removes the specified path listener from this model.- Parameters:
l
- Path listener to remove.
-
firePathChanged
protected void firePathChanged(int indexOfFirstChange) Fires aBreadcrumbPathEvent
.- Parameters:
indexOfFirstChange
- Index of the first item that has changed in the model.
-