com.dlsc.flexgantt.model.paging

## Class DefaultPagingModel

- java.lang.Object
- - com.dlsc.flexgantt.model.paging.DefaultPagingModel

- All Implemented Interfaces:
    IPagingModel

      public class DefaultPagingModel
      extends Object
      implements IPagingModel

  The default implementation of a paging model, which stores pages in a simple sorted list.
  Since:
    1.0
  Version:
    $Revision: 1.8 $
  Author:
    Dirk Lemmermann

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultPagingModel()` Constructs a new paging model.
    `DefaultPagingModel(List<Page> pages)` Constructs a new paging model.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPage(Page page)` Adds a page to the model causing a `PagingEvent` to be fired.
    `void` | `addPagingModelListener(IPagingModelListener l)` Adds a listener to the paging model.
    `void` | `clearPages()` Clears / removes all pages from the model.
    `void` | `earlierPage()` Goto the next page that has a smaller start time than the currently used page.
    `protected void` | `firePageChangedEvent(PagingEvent evt)` Sends a paging event to all listeners that are observing the model.
    `protected void` | `firePageWillChangeEvent(PagingEvent evt)`
    `void` | `firstPage()` Goto the first page.
    `Page` | `getPage()` Returns the currently used page.
    `Page` | `getPage(int index)` Returns the page for the given index.
    `int` | `getPageCount()` Returns the total number of pages added to the model.
    `boolean` | `hasEarlierPage()` Determines if the model has a page that starts earlier than the currently used page.
    `boolean` | `hasLaterPage()` Determines if the model has a page that starts later than the currently used page.
    `void` | `lastPage()` Goto the last page.
    `void` | `laterPage()` Goto the next page that has a larger start time than the currently used page.
    `void` | `removePage(Page page)` Removes a page from the model causing a `PagingEvent` to be fired.
    `void` | `removePagingModelListener(IPagingModelListener l)` Removes a listener from the paging model.
    `void` | `setPage(Page page)` Sets a new page to be used.
    `void` | `setPages(List<Page> 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

    - #### DefaultPagingModel

          public DefaultPagingModel(List<Page> pages)

      Constructs a new paging model.
      Parameters:
        `pages` - a list of pages to fill the model
      Since:
        1.0

    - #### DefaultPagingModel

          public DefaultPagingModel()

      Constructs a new paging model.
      Since:
        1.0

  - ### Method Detail

    - #### setPages

          public void setPages(List<Page> 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:
        `clearPages()`, `addPage(Page)`

    - #### clearPages

          public void clearPages()

      Clears / removes all pages from the model. An event will be fired for each page that gets removed.
      Since:
        1.0
      See Also:
        `removePage(Page)`

    - #### addPage

          public void addPage(Page page)

      Adds a page to the model causing a `PagingEvent` to be fired. The ID of the event will be `PagingEvent.ID.PAGE_ADDED`.
      Parameters:
        `page` - the page that will be added to the model
      Since:
        1.0
      See Also:
        `setPages(List)`, `removePage(Page)`

    - #### removePage

          public void removePage(Page page)

      Removes a page from the model causing a `PagingEvent` to be fired. The ID of the event will be `PagingEvent.ID.PAGE_REMOVED`.
      Parameters:
        `page` - the page that will be removed from the model
      Since:
        1.0
      See Also:
        `clearPages()`, `addPage(Page)`

    - #### getPage

          public Page getPage()

      Description copied from interface: `IPagingModel`
      Returns the currently used page.
      Specified by:
        `getPage` in interface `IPagingModel`
      Returns:
        the currently used page
      See Also:
        `IPagingModel.setPage(Page)`

    - #### setPage

          public void setPage(Page page)

      Description copied from interface: `IPagingModel`
      Sets a new page to be used.
      Specified by:
        `setPage` in interface `IPagingModel`
      Parameters:
        `page` - the new page to use for display

    - #### getPageCount

          public int getPageCount()

      Description copied from interface: `IPagingModel`
      Returns the total number of pages added to the model.
      Specified by:
        `getPageCount` in interface `IPagingModel`
      Returns:
        the total number of pages in the model
      See Also:
        `IPagingModel.getPage(int)`

    - #### getPage

          public Page getPage(int index)

      Description copied from interface: `IPagingModel`
      Returns the page for the given index.
      Specified by:
        `getPage` in interface `IPagingModel`
      Returns:
        a page for the given index
      See Also:
        `IPagingModel.getPageCount()`

    - #### addPagingModelListener

          public void addPagingModelListener(IPagingModelListener l)

      Description copied from interface: `IPagingModel`
      Adds a listener to the paging model.
      Specified by:
        `addPagingModelListener` in interface `IPagingModel`
      Parameters:
        `l` - the listener to add to the model

    - #### removePagingModelListener

          public void removePagingModelListener(IPagingModelListener l)

      Description copied from interface: `IPagingModel`
      Removes a listener from the paging model.
      Specified by:
        `removePagingModelListener` in interface `IPagingModel`
      Parameters:
        `l` - the listener to remove from the model

    - #### firePageWillChangeEvent

          protected void firePageWillChangeEvent(PagingEvent evt)
                                          throws PagingVetoException

      Parameters:
        `evt` -
      Throws:
        `PagingVetoException`
      Since:
        1.0

    - #### firePageChangedEvent

          protected void firePageChangedEvent(PagingEvent 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

    - #### firstPage

          public void firstPage()

      Description copied from interface: `IPagingModel`
      Goto the first page.
      Specified by:
        `firstPage` in interface `IPagingModel`

    - #### earlierPage

          public void earlierPage()

      Description copied from interface: `IPagingModel`
      Goto the next page that has a smaller start time than the currently used page.
      Specified by:
        `earlierPage` in interface `IPagingModel`

    - #### laterPage

          public void laterPage()

      Description copied from interface: `IPagingModel`
      Goto the next page that has a larger start time than the currently used page.
      Specified by:
        `laterPage` in interface `IPagingModel`

    - #### lastPage

          public void lastPage()

      Description copied from interface: `IPagingModel`
      Goto the last page.
      Specified by:
        `lastPage` in interface `IPagingModel`

    - #### hasEarlierPage

          public boolean hasEarlierPage()

      Description copied from interface: `IPagingModel`
      Determines if the model has a page that starts earlier than the currently used page.
      Specified by:
        `hasEarlierPage` in interface `IPagingModel`
      Returns:
        TRUE if a page exists that has a smaller start time than the currently used page
      See Also:
        `IPagingModel.earlierPage()`

    - #### hasLaterPage

          public boolean hasLaterPage()

      Description copied from interface: `IPagingModel`
      Determines if the model has a page that starts later than the currently used page.
      Specified by:
        `hasLaterPage` in interface `IPagingModel`
      Returns:
        TRUE if a page exists that has a larger start time than the currently used page
      See Also:
        `IPagingModel.laterPage()`

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.