T
- Type of data associated with each breadcrumb bar item.public class BreadcrumbBarModel<T>
extends java.lang.Object
JBreadcrumbBar
).Modifier and Type | Field | Description |
---|---|---|
protected boolean |
isCumulative |
Indication whether the model is in cumulative mode.
|
protected javax.swing.event.EventListenerList |
listenerList |
Listener list.
|
protected int |
smallestCumulativeIndex |
Smallest index of path change since the last call to
setCumulative(boolean) with true . |
Constructor | Description |
---|---|
BreadcrumbBarModel() |
Creates a new empty model.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addLast(BreadcrumbItem<T> item) |
Adds the specified item at the end of the path.
|
void |
addPathListener(BreadcrumbPathListener l) |
Adds the specified path listener to this model.
|
protected void |
firePathChanged(int indexOfFirstChange) |
Fires a
BreadcrumbPathEvent . |
BreadcrumbItem<T> |
getItem(int index) |
Returns the model item at the specified index.
|
int |
getItemCount() |
Returns the number of items in this model.
|
java.util.List<BreadcrumbItem<T>> |
getItems() |
Returns an unmodifiable list of the items in this model.
|
int |
indexOf(BreadcrumbItem<T> item) |
Returns the index of the specified item.
|
void |
removeLast() |
Removes the last item in this model.
|
void |
removePathListener(BreadcrumbPathListener l) |
Removes the specified path listener from this model.
|
void |
replace(java.util.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.
|
protected javax.swing.event.EventListenerList listenerList
protected boolean isCumulative
setCumulative(boolean)
protected int smallestCumulativeIndex
setCumulative(boolean)
with true
.public int indexOf(BreadcrumbItem<T> item)
item
- Item.public void removeLast()
public void reset()
public java.util.List<BreadcrumbItem<T>> getItems()
public int getItemCount()
public BreadcrumbItem<T> getItem(int index)
index
- Item index.null
if the index is negative or larger than the
number of items.public void replace(java.util.List<BreadcrumbItem<T>> items)
items
- New contents of the model.public void addLast(BreadcrumbItem<T> item)
item
- Item to add.public void setCumulative(boolean isCumulative)
addLast(BreadcrumbItem)
, removeLast()
,
replace(List)
and reset()
will not fire events on the
listeners registered with
addPathListener(BreadcrumbPathListener)
.isCumulative
- If true
, the model enters cumulative mode. If
false
, 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 with true
.public void addPathListener(BreadcrumbPathListener l)
l
- Path listener to add.public void removePathListener(BreadcrumbPathListener l)
l
- Path listener to remove.protected void firePathChanged(int indexOfFirstChange)
BreadcrumbPathEvent
.indexOfFirstChange
- Index of the first item that has changed in the model.