org.pushingpixels.flamingo.api.bcb
T
- Type of data associated with each breadcrumb bar item.public class BreadcrumbBarModel<T> extends Object
JBreadcrumbBar
).Modifier and Type | Field and Description |
---|---|
protected boolean |
isCumulative
Indication whether the model is in cumulative mode.
|
protected EventListenerList |
listenerList
Listener list.
|
protected int |
smallestCumulativeIndex
Smallest index of path change since the last call to
setCumulative(boolean) with true . |
Constructor and Description |
---|
BreadcrumbBarModel()
Creates a new empty model.
|
Modifier and Type | Method and 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.
|
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(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 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 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(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.