Class GuiApplication

  • All Implemented Interfaces:
    Runnable, ProgressNotifier
    Direct Known Subclasses:
    Installer, Uninstaller

    public abstract class GuiApplication
    extends Application
    This class represents an application with a wizard GUI that can be run in the context of QuickSetup. Examples of applications might be 'installer', and 'uninstaller'.
    • Constructor Detail

      • GuiApplication

        public GuiApplication()
        Constructs an instance of an application. Subclasses of this application must have a default constructor.
    • Method Detail

      • getFrameTitle

        public abstract org.forgerock.i18n.LocalizableMessage getFrameTitle()
        Gets the frame title of the GUI application that will be used in some operating systems.
        Returns:
        internationalized String representing the frame title
      • getFirstWizardStep

        public abstract WizardStep getFirstWizardStep()
        Returns the initial wizard step.
        Returns:
        Step representing the first step to show in the wizard
      • setDisplayedWizardStep

        public void setDisplayedWizardStep​(WizardStep step,
                                           UserData userData,
                                           QuickSetupDialog dlg)
        Called by the quicksetup controller when the user advances to a new step in the wizard. Applications are expected to manipulate the QuickSetupDialog to reflect the current step.
        Parameters:
        step - Step indicating the new current step
        userData - UserData representing the data specified by the user
        dlg - QuickSetupDialog hosting the wizard
      • setWizardDialogState

        public abstract void setWizardDialogState​(QuickSetupDialog dlg,
                                                  UserData userData,
                                                  WizardStep step)
        Called when the user advances to new step in the wizard. Applications are expected to manipulate the QuickSetupDialog to reflect the current step.
        Parameters:
        dlg - QuickSetupDialog hosting the wizard
        userData - UserData representing the data specified by the user
        step - Step indicating the new current step
      • getTab

        protected org.forgerock.i18n.LocalizableMessage getTab()
        Returns the tab formatted.
        Returns:
        the tab formatted.
      • windowClosing

        public abstract void windowClosing​(QuickSetupDialog dlg,
                                           WindowEvent evt)
        Called by the controller when the window is closing. The application can take application specific actions here.
        Parameters:
        dlg - QuickSetupDialog that will be closing
        evt - The event from the Window indicating closing
      • forceToDisplay

        public void forceToDisplay()
        This method is called when we detected that there is something installed we inform of this to the user and the user wants to proceed with the installation destroying the contents of the data and the configuration in the current installation.
      • confirmCancel

        public boolean confirmCancel​(QuickSetup qs)
        Called before the application cancels its operation, giving the user a chance to confirm the cancellation action.
        Parameters:
        qs - QuickSetup that can be used for confirming
        Returns:
        boolean where true indicates that the user answered affirmatively to the cancelation confirmation
      • getInitialFocusButtonName

        public abstract ButtonName getInitialFocusButtonName()
        Get the name of the button that will receive initial focus.
        Returns:
        ButtonName of the button to receive initial focus
      • createFramePanel

        public JPanel createFramePanel​(QuickSetupDialog dlg)
        Creates the main panel for the wizard dialog.
        Parameters:
        dlg - QuickSetupDialog used
        Returns:
        JPanel frame panel
      • getWizardSteps

        public abstract Set<? extends WizardStep> getWizardSteps()
        Returns the set of wizard steps used in this application's wizard.
        Returns:
        Set of Step objects representing wizard steps
      • createWizardStepPanel

        public abstract QuickSetupStepPanel createWizardStepPanel​(WizardStep step)
        Creates a wizard panel given a specific step.
        Parameters:
        step - for which a panel representation should be created
        Returns:
        QuickSetupStepPanel for representing the step
      • getNextWizardStep

        public abstract WizardStep getNextWizardStep​(WizardStep step)
        Gets the next step in the wizard given a current step.
        Parameters:
        step - Step the current step
        Returns:
        Step the next step
      • getPreviousWizardStep

        public abstract WizardStep getPreviousWizardStep​(WizardStep step)
        Gets the previous step in the wizard given a current step.
        Parameters:
        step - Step the current step
        Returns:
        Step the previous step
      • getFinishedStep

        public abstract WizardStep getFinishedStep()
        Gets the finished step in the wizard.
        Returns:
        Step the finished step
      • getCurrentWizardStep

        public WizardStep getCurrentWizardStep()
        Gets the currently displayed wizard step.
        Returns:
        WizardStep being displayed.
      • isSubStep

        public boolean isSubStep​(WizardStep step)
        Indicates whether the provided step is a sub step or not.
        Parameters:
        step - WizardStep for which the return value indicates whether or not is a sub step.
        Returns:
        boolean where true indicates the provided step is a substep.
      • isVisible

        public boolean isVisible​(WizardStep step,
                                 UserData userData)
        Indicates whether the provided step is visible or not depending on the contents of the UserData object that is provided.
        Parameters:
        step - WizardStep for which the return value indicates whether or not is visible.
        userData - the UserData to be used to determine if the step is visible or not.
        Returns:
        boolean where true indicates the provided step is visible.
      • isVisible

        public boolean isVisible​(WizardStep step,
                                 QuickSetup qs)
        Indicates whether the provided step is visible or not depending on the contents of the QuickSetup object that is provided.
        Parameters:
        step - WizardStep for which the return value indicates whether or not is visible.
        qs - the QuickSetup to be used to determine if the step is visible or not.
        Returns:
        boolean where true indicates the provided step is visible.
      • getOrderedSteps

        public LinkedHashSet<WizardStep> getOrderedSteps()
        Returns the list of all the steps in an ordered manner. This is required because in the case of an application with substeps the user of the other interfaces is not enough. This is a default implementation that uses the getNextWizardStep method to calculate the list that work for applications with no substeps.
        Returns:
        a list containing ALL the steps (including substeps) in an ordered manner.
      • canGoBack

        public boolean canGoBack​(WizardStep step)
        Indicates whether the user is allowed to return to a previous step from step.
        Parameters:
        step - WizardStep for which the the return value indicates whether or not the user can return to a previous step
        Returns:
        boolean where true indicates the user can return to a previous step from step
      • canGoForward

        public boolean canGoForward​(WizardStep step)
        Indicates whether the user is allowed to move to a new step from step.
        Parameters:
        step - WizardStep for which the the return value indicates whether or not the user can move to a new step
        Returns:
        boolean where true indicates the user can move to a new step from step
      • canFinish

        public abstract boolean canFinish​(WizardStep step)
        Indicates whether the user is allowed to finish the wizard from step.
        Parameters:
        step - WizardStep for which the the return value indicates whether or not the user can finish the wizard
        Returns:
        boolean where true indicates the user can finish the wizard
      • previousClicked

        public abstract void previousClicked​(WizardStep cStep,
                                             QuickSetup qs)
        Called when the user has clicked the 'previous' button.
        Parameters:
        cStep - WizardStep at which the user clicked the previous button
        qs - QuickSetup controller
      • finishClicked

        public abstract boolean finishClicked​(WizardStep cStep,
                                              QuickSetup qs)
        Called when the user has clicked the 'finish' button.
        Parameters:
        cStep - WizardStep at which the user clicked the previous button
        qs - QuickSetup controller
        Returns:
        boolean that the application uses to indicate the the application should be launched. If false, the application is responsible for updating the user data for the final screen and launching the application if this is the desired behavior.
      • nextClicked

        public abstract void nextClicked​(WizardStep cStep,
                                         QuickSetup qs)
        Called when the user has clicked the 'next' button.
        Parameters:
        cStep - WizardStep at which the user clicked the next button
        qs - QuickSetup controller
      • closeClicked

        public void closeClicked​(WizardStep cStep,
                                 QuickSetup qs)
        Called when the user has clicked the 'close' button.
        Parameters:
        cStep - WizardStep at which the user clicked the close button
        qs - QuickSetup controller
      • quitClicked

        public void quitClicked​(WizardStep step,
                                QuickSetup qs)
        Called when the user has clicked the 'quit' button.
        Parameters:
        step - WizardStep at which the user clicked the quit button
        qs - QuickSetup controller
      • updateUserData

        public abstract void updateUserData​(WizardStep cStep,
                                            QuickSetup qs)
                                     throws UserDataException
        Called whenever this application should update its user data from values found in QuickSetup.
        Parameters:
        cStep - current wizard step
        qs - QuickSetup controller
        Throws:
        UserDataException - if there is a problem with the data
      • getCloseButtonToolTip

        public org.forgerock.i18n.LocalizableMessage getCloseButtonToolTip()
        Gets the key for the close button's tool tip text.
        Returns:
        String key of the text in the resource bundle
      • getQuitButtonToolTip

        public org.forgerock.i18n.LocalizableMessage getQuitButtonToolTip()
        Gets the key for the quit button's tool tip text.
        Returns:
        String key of the text in the resource bundle
      • getFinishButtonToolTip

        public org.forgerock.i18n.LocalizableMessage getFinishButtonToolTip()
        Gets the key for the finish button's tool tip text.
        Returns:
        String key of the text in the resource bundle
      • getFinishButtonLabel

        public org.forgerock.i18n.LocalizableMessage getFinishButtonLabel()
        Gets the key for the finish button's label.
        Returns:
        String key of the text in the resource bundle
      • finishOnLeft

        public boolean finishOnLeft()
        Indicates whether the finish button must be placed on the left (close to "Next" button) or on the right (close to "Quit" button).
        Returns:
        true if the finish button must be placed on the left and false otherwise.
      • acceptCertificateForException

        protected void acceptCertificateForException​(UserDataCertificateException ce,
                                                     boolean acceptPermanently)
        Updates the list of certificates accepted by the user in the trust manager based on the information stored in the UserDataCertificateException we got when trying to connect in secure mode.
        Parameters:
        ce - the UserDataCertificateException that contains the information to be used.
        acceptPermanently - whether the certificate must be accepted permanently or not.
      • getExtraDialogHeight

        public int getExtraDialogHeight()
        Gets the amount of addition pixels added to the height of the tallest panel in order to size the wizard for asthetic reasons.
        Returns:
        int height to add
      • setQuickSetupDialog

        public void setQuickSetupDialog​(QuickSetupDialog dialog)
        Sets the QuickSetupDialog driving this application.
        Parameters:
        dialog - QuickSetupDialog driving this application
      • setUserArguments

        public void setUserArguments​(String[] args)
        Sets the arguments passed in the command-line to launch the application.
        Parameters:
        args - the arguments passed in the command-line to launch the application.
      • getUserArguments

        public String[] getUserArguments()
        Returns the arguments passed in the command-line to launch the application.
        Returns:
        the arguments passed in the command-line to launch the application.