Package se.conciliate.extensions.ui
Interface Binder
public interface Binder
Keeps track of all pages opened in the user interface.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new listener for changes to the binder.void
closeAllPages
(boolean checkForUnsavedChanges, Runnable callback) Closes all currently opened pages.void
closeCurrentPage
(boolean checkForUnsavedChanges, Runnable callback) Closes the current page.void
closeOtherPages
(boolean checkForUnsavedChanges, Runnable callback) Closes all but the currently selected page.void
Closes a previously opened page.void
Finds all currently opened pages.Page<?>
Finds a currently opened page in the UI.Page<?>
findPageByContent
(Object content) Finds a currently opened page in the UI by its content.findPageByTag
(String tag) Finds a currently opened page in the UI by its optional tag.Page<?>
Returns the currently selected page.boolean
isAttached
(Page<?> page) Returns true if the page is attached in the binder, i.e.void
openAttachedPage
(Page<?> page) Opens a page and makes it attached, i.e.void
openAttachedPage
(Page<?> page, int relativePosition) Opens a page at a given index and makes it attached, i.e.void
Opens a page in the user interface.void
openPageAt
(Page<?> page, int relativePosition) Opens a page in the user interface at the relative position given.void
Removes a listener for changes to the binder.
-
Method Details
-
addBinderListener
Adds a new listener for changes to the binder.- Parameters:
l
- The listener to add.- Since:
- 3.2
-
removeBinderListener
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
Returns true if the page is attached in the binder, i.e. not closeable by user. -
findPage
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
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
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
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
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
Opens a page and makes it attached, i.e. not removable by user. -
openAttachedPage
Opens a page at a given index and makes it attached, i.e. not removable by user. -
openPageAt
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 withopenPage
) will have a relative position ofInteger.MAX_VALUE
.- See Also:
-
closePage
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), ornull
if no callback is needed.- Since:
- 3.2
-
closePage
-
closeCurrentPage
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), ornull
if no callback is needed.- Since:
- 3.2
-
closeAllPages
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), ornull
if no callback is needed.- Since:
- 3.2
-
closeOtherPages
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), ornull
if no callback is needed.- Since:
- 3.2
-