Skip to content

Latest commit

 

History

History
103 lines (88 loc) · 4.06 KB

File metadata and controls

103 lines (88 loc) · 4.06 KB
AbstractFrame

AbstractFrame is the root of the controller classes hierarchy. Below is the description of its main methods:

  • init() is called by the framework after creating components tree described by an XML-descriptor, but before a screen is displayed.

    init() method accepts a map of parameters that can be used in controller. These parameters can be passed both from the controller of the calling screen (using openWindow(), openLookup() or openEditor() methods) or defined in the screen registration file screens.xml.

    init() method should be implemented if it is necessary to initialize screen components, for example:

    link:../../../../../../source/gui/abstractframe_1.java[role=include]
  • getMessage(), formatMessage() – methods for retrieving localized messages from a pack, defined for a screen in the XML-descriptor. They work as shortcuts for calling the corresponding methods of the Messages interface.

  • openFrame() – loads a frame according to an identifier registered in screens.xml file. If the method receives a container component from the invoking code, the frame is shown within the container. The method returns frame controller. For example:

    link:../../../../../../source/gui/abstractframe_3.java[role=include]

    It is not required to pass the container immediately via openFrame() method, instead it is possible to load the frame first and then add it to the necessary container:

    link:../../../../../../source/gui/abstractframe_4.java[role=include]
  • openWindow(), openLookup(), openEditor() – open a simple screen, a lookup screen, or an edit screen respectively. Methods return a controller of the created screen.

    For the dialog mode, the method openWindow() can be called with parameters, for example:

    link:../../../../../../source/gui/abstractframe_7.java[role=include]

    These parameters will be considered if they don’t conflict with the higher-priority parameters of the window being opened. The latter can be set either in the getDialogOptions() method of screen controller or in XML descriptor of the screen:

    link:../../../../../../source/gui/abstractframe_8.xml[role=include]

    CloseListener can be added in order to perform actions after the invoked screen closes, for example:

    link:../../../../../../source/gui/abstractframe_5.java[role=include]

    Use CloseWithCommitListener to be notified only when the invoked screen closes by an action with the Window.COMMIT_ACTION_ID name (i.e. OK button), for example:

    link:../../../../../../source/gui/abstractframe_5_1.java[role=include]
  • showMessageDialog() – shows a dialog box with a message.

  • showOptionDialog() – shows a dialog box with a message and an option for user to invoke certain actions. Actions are defined by an array of Action type items displayed as buttons in the dialog.

    It is recommended to use DialogAction objects for display of standard buttons such as OK, Cancel and other, for example:

    link:../../../../../../source/gui/abstractframe_6.java[role=include]
  • showNotification() – shows a pop up notification.

  • showWebPage() – opens specified web page in a browser.