com.dlsc.flexgantt.model.bookmarks
Class DefaultBookmarkModel

java.lang.Object
  extended by com.dlsc.flexgantt.model.bookmarks.DefaultBookmarkModel
All Implemented Interfaces:
IBookmarkModel

public class DefaultBookmarkModel
extends java.lang.Object
implements IBookmarkModel

The default implementation of a paging model, which stores pages in a simple sorted list.

Since:
1.0
Author:
Dirk Lemmermann

Constructor Summary
DefaultBookmarkModel()
          Constructs a new paging model.
DefaultBookmarkModel(java.util.List<Bookmark> pages)
          Constructs a new paging model.
 
Method Summary
 void addBookmark(Bookmark bookmark)
          Adds a bookmark to the model causing a BookmarkEvent to be fired.
 void addBookmarkModelListener(IBookmarkModelListener l)
          Adds a listener to the bookmark model.
 void clearBookmarks()
          Clears / removes all pages from the model.
protected  void fireBookmarksChangedEvent(BookmarkEvent evt)
          Sends a paging event to all listeners that are observing the model.
 Bookmark getBookmark(int index)
          Returns the bookmark for the given index.
 int getBookmarkCount()
          Returns the total number of bookmarks added to the model.
 void removeBookmark(Bookmark bookmark)
          Removes a bookmark from the model causing a BookmarkEvent to be fired.
 void removeBookmarkModelListener(IBookmarkModelListener l)
          Removes a listener from the bookmark model.
 void setBookmarks(java.util.List<Bookmark> pages)
          Sets several pages at once after clearing the current list of pages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBookmarkModel

public DefaultBookmarkModel(java.util.List<Bookmark> pages)
Constructs a new paging model.

Parameters:
pages - a list of pages to fill the model
Since:
1.0

DefaultBookmarkModel

public DefaultBookmarkModel()
Constructs a new paging model.

Since:
1.0
Method Detail

setBookmarks

public void setBookmarks(java.util.List<Bookmark> pages)
Sets several pages at once after clearing the current list of pages.

Parameters:
pages - the list of pages that will be served by the model
Since:
1.0
See Also:
clearBookmarks(), addBookmark(Bookmark)

clearBookmarks

public void clearBookmarks()
Clears / removes all pages from the model. An event will be fired for each page that gets removed.

Since:
1.0
See Also:
removeBookmark(Bookmark)

addBookmark

public void addBookmark(Bookmark bookmark)
Adds a bookmark to the model causing a BookmarkEvent to be fired. The ID of the event will be BookmarkEvent.ID.BOOKMARK_ADDED.

Specified by:
addBookmark in interface IBookmarkModel
Parameters:
bookmark - the bookmark that will be added to the model
Since:
1.0
See Also:
setBookmarks(List), removeBookmark(Bookmark)

removeBookmark

public void removeBookmark(Bookmark bookmark)
Removes a bookmark from the model causing a BookmarkEvent to be fired. The ID of the event is BookmarkEvent.ID.BOOKMARK_REMOVED.

Specified by:
removeBookmark in interface IBookmarkModel
Parameters:
bookmark - the bookmark that will be removed from the model
Since:
1.0
See Also:
clearBookmarks(), addBookmark(Bookmark)

getBookmarkCount

public int getBookmarkCount()
Description copied from interface: IBookmarkModel
Returns the total number of bookmarks added to the model.

Specified by:
getBookmarkCount in interface IBookmarkModel
Returns:
the total number of bookmarks in the model
See Also:
IBookmarkModel.getBookmark(int)

getBookmark

public Bookmark getBookmark(int index)
Description copied from interface: IBookmarkModel
Returns the bookmark for the given index.

Specified by:
getBookmark in interface IBookmarkModel
Returns:
a bookmark for the given index
See Also:
IBookmarkModel.getBookmarkCount()

addBookmarkModelListener

public void addBookmarkModelListener(IBookmarkModelListener l)
Description copied from interface: IBookmarkModel
Adds a listener to the bookmark model.

Specified by:
addBookmarkModelListener in interface IBookmarkModel
Parameters:
l - the listener to add to the model

removeBookmarkModelListener

public void removeBookmarkModelListener(IBookmarkModelListener l)
Description copied from interface: IBookmarkModel
Removes a listener from the bookmark model.

Specified by:
removeBookmarkModelListener in interface IBookmarkModel
Parameters:
l - the listener to remove from the model

fireBookmarksChangedEvent

protected void fireBookmarksChangedEvent(BookmarkEvent evt)
Sends a paging event to all listeners that are observing the model.

Parameters:
evt - the event used for notifying the listeners about a change within the model
Since:
1.0