Interface Binder


public interface Binder
Keeps track of all pages opened in the user interface.
  • Method Details

    • addBinderListener

      void addBinderListener(BinderListener l)
      Adds a new listener for changes to the binder.
      Parameters:
      l - The listener to add.
      Since:
      3.2
    • removeBinderListener

      void removeBinderListener(BinderListener l)
      Removes a listener for changes to the binder.
      Parameters:
      l - The listener to remove.
      Since:
      3.2
    • getSelectedPage

      Page<?> getSelectedPage()
      Returns the currently selected page.
      Returns:
      The currently selected page.
      Since:
      3.2
    • isAttached

      boolean isAttached(Page<?> page)
      Returns true if the page is attached in the binder, i.e. not closeable by user.
    • findPage

      Page<?> findPage(Page<?> page)
      Finds a currently opened page in the UI.
      Parameters:
      page - The page to find.
      Returns:
      A page or null if the page is not currently open.
      Since:
      3.2
    • findAllPages

      List<Page<?>> findAllPages()
      Finds all currently opened pages.
      Returns:
      A list containing all open pages. This list is sorted based on the current layout. (If Pages are layed out left to right, the leftmost Page will be at index 0 in the list.)
      Since:
      3.2
    • findPageByContent

      Page<?> findPageByContent(Object content)
      Finds a currently opened page in the UI by its content.
      Parameters:
      content - The content of the page to find.
      Returns:
      The first page with content that equals the supplied content, or null if no such page is found.
      Since:
      3.2
    • findPageByTag

      Optional<Page<?>> findPageByTag(String tag)
      Finds a currently opened page in the UI by its optional tag.
      Parameters:
      tag - The tag of the page to find.
      Returns:
      The first page with a tag that equals the supplied tag, or null if no such page is found.
      Since:
      4.3
    • openPage

      void openPage(Page<?> page)
      Opens a page in the user interface. If this page is already open it will become the selected page.
      Parameters:
      page - The page to open.
      Since:
      3.2
    • openAttachedPage

      void openAttachedPage(Page<?> page)
      Opens a page and makes it attached, i.e. not removable by user.
    • openAttachedPage

      void openAttachedPage(Page<?> page, int relativePosition)
      Opens a page at a given index and makes it attached, i.e. not removable by user.
    • openPageAt

      void openPageAt(Page<?> page, int relativePosition)
      Opens a page in the user interface at the relative position given. A relative position can be any integer. If two pages are opened with the same relative position, they will appear in a "first-in-first-displayed" (FIFO) manner. What "first displayed" means is up to the implementation but as an example, a binder functioning as a horisontal tabbed pane will likely interpret first as the left-most tab in most locales. Thus, for such a binder, the first page that is opened with the position 7, will be the left-most page out of all pages with the position 7.

      When there occupying the same position, the page will be ordered so that the page with the smallest position is placed "before" pages with higher positions. Again, it is up to the implementation to decide what "before" means but in a horisontal tabbed pane, it is likely that "before" is interpreted as "more to the left".

      If the page is already open, the position argument will be ignored and the page will become the selected page (without changing position).
      Parameters:
      page - The page to open.
      relativePosition - The position of the page relative the other pages. Pages that are not opened with a relative position (those opened with openPage) will have a relative position of Integer.MAX_VALUE.
      See Also:
    • closePage

      void closePage(Page<?> page, boolean checkForUnsavedChanges, Runnable callback)
      Closes a previously opened page.
      Parameters:
      page - The page to close.
      checkForUnsavedChanges - true if a dialog should be shown to the user if there are unsaved changes.
      callback - A callback that will be called on the EDT when the tab has been closed (and saved if so chosen), or null if no callback is needed.
      Since:
      3.2
    • closePage

      void closePage(Page<?> page, boolean checkForUnsavedChanges, Runnable callback, boolean forceClose)
    • closeCurrentPage

      void closeCurrentPage(boolean checkForUnsavedChanges, Runnable callback)
      Closes the current page.
      Parameters:
      checkForUnsavedChanges - true if a dialog should be shown to the user if there are unsaved changes.
      callback - A callback that will be called on the EDT when the tab has been closed (and saved if so chosen), or null if no callback is needed.
      Since:
      3.2
    • closeAllPages

      void closeAllPages(boolean checkForUnsavedChanges, Runnable callback)
      Closes all currently opened pages.
      Parameters:
      checkForUnsavedChanges - true if a dialog should be shown to the user if there are unsaved changes.
      callback - A callback that will be called on the EDT when all pages have been closed (and saved if so chosen), or null if no callback is needed.
      Since:
      3.2
    • closeOtherPages

      void closeOtherPages(boolean checkForUnsavedChanges, Runnable callback)
      Closes all but the currently selected page.
      Parameters:
      checkForUnsavedChanges - true if a dialog should be shown to the user if there are unsaved changes.
      callback - A callback that will be called on the EDT when all pages have been closed (and saved if so chosen), or null if no callback is needed.
      Since:
      3.2