Interface Page<T>

Type Parameters:
T - The type of the content that this Page 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 Details

    • getTag

      default Optional<String> 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()
      Returns true if the page allows itself being closed. If false 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

      Callable<Boolean> getSaveCallable()
      Returns a callable that will be called on a worker thread to save changes to the page. The callable should return true if the changes were saved successfully.
      Returns:
      A Callable to save changes or null 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

      Icon getIcon(int dimension)
      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

      void setLanguage(MTLanguage language)
      Called when the user changes language. May be ignored (of course). This is not the Locale and should not be confused with it. The Locale 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

      void addChangeListener(ChangeListener cl)
      Adds a change listener that will be notified when the state of the page has changed.
      Parameters:
      cl - The ChangeListener to add.
    • removeChangeListener

      void removeChangeListener(ChangeListener cl)
      Removes a change listener.
      Parameters:
      cl - The ChangeListener to remove.
    • setRemoteChangeHandler

      boolean setRemoteChangeHandler(MTRemoteChangeHandler handler)
      Tries to set a custom remote change handler on a page. If true 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.