Package se.conciliate.extensions.ui
Interface Page<T>
- Type Parameters:
T
- The type of the content that thisPage
will be showing. That is, the underlying data model that it's getComponent() is a view for.
public interface Page<T>
This must be implemented by any "view" that is to be shown in
the modeling tool. To open a new page, obtain a
Binder
service from OSGi which will allow you to open, close and find
pages in the user interface.- Since:
- 3.2
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a change listener that will be notified when the state of the page has changed.boolean
canClose()
Returnstrue
if the page allows itself being closed.void
dispose()
This will be called before the page is closed to allow releasing any resources no longer needed.Returns the page component to show in the UI.Returns the domain-specific content for this page.getIcon
(int dimension) Should return a small icon to show for the page.Returns a callable that will be called on a worker thread to save changes to the page.getTag()
Returns an optional tag that can be used to find the page later.getTitle()
Returns the current title of the page.default boolean
Returns true if the program should ask the user aboutboolean
isSaved()
Checks if there are changes made to the page.void
Removes a change listener.void
setLanguage
(MTLanguage language) Called when the user changes language.boolean
Tries to set a custom remote change handler on a page.
-
Method Details
-
getTag
Returns an optional tag that can be used to find the page later. -
getContent
T getContent()Returns the domain-specific content for this page.- Returns:
- The content of the page. This could be anything but should at least identify (proper equals).
-
getComponent
JComponent getComponent()Returns the page component to show in the UI. This should return the same reference throughout the lifetime of the page.- Returns:
- A
JComponent
which will be shown in the UI. - Since:
- 3.2
-
canClose
boolean canClose()Returnstrue
if the page allows itself being closed. Iffalse
is returned the user should be notified in some way by the page.- Returns:
true
if the page can be closed.
-
isSaved
boolean isSaved()Checks if there are changes made to the page.- Returns:
true
if there are unsaved changes.- Since:
- 3.2
-
getSaveCallable
Returns a callable that will be called on a worker thread to save changes to the page. The callable should returntrue
if the changes were saved successfully.- Returns:
- A
Callable
to save changes ornull
if no changes need to be saved. - Since:
- 3.2
-
isAskBeforeClosingUnsaved
default boolean isAskBeforeClosingUnsaved()Returns true if the program should ask the user about- Since:
- 4.3
-
dispose
void dispose()This will be called before the page is closed to allow releasing any resources no longer needed. This method should de-register this page as a service in OSGi.- Since:
- 3.2
-
getTitle
String getTitle()Returns the current title of the page. If the content of this page is MTLanguage-aware, remember to return a title based on that language.- Returns:
- The title in the current language.
- Since:
- 3.2
-
getIcon
Should return a small icon to show for the page.- Parameters:
dimension
- The dimension expected for the icon (in pixels).- Returns:
- An icon that is (dimension x dimension) in size, or
null
if no icon should be shown for this page. - Since:
- 3.2
-
setLanguage
Called when the user changes language. May be ignored (of course). This is not theLocale
and should not be confused with it. TheLocale
is only used to display messages, menus and such. The MTLanguage is created by the user to be able to describe data in different languages - completely independent of the Locale.- Parameters:
language
- The new language.
-
addChangeListener
Adds a change listener that will be notified when the state of the page has changed.- Parameters:
cl
- TheChangeListener
to add.
-
removeChangeListener
Removes a change listener.- Parameters:
cl
- TheChangeListener
to remove.
-
setRemoteChangeHandler
Tries to set a custom remote change handler on a page. Iftrue
is returned, the page implementation should delegate to this handler for any remote change exceptions that arises as part of editing the page.- Parameters:
handler
- The handler.- Returns:
true
if the page accepts the custom handler and will delegate to it for all remote change exceptions.
-