Class ApprovalDialog

    • Field Detail

      • APPROVE_OPTION

        public static final int APPROVE_OPTION
        the approve option.
        See Also:
        Constant Field Values
      • DISCARD_OPTION

        public static final int DISCARD_OPTION
        the discard option.
        See Also:
        Constant Field Values
      • CANCEL_OPTION

        public static final int CANCEL_OPTION
        the cancel option.
        See Also:
        Constant Field Values
      • m_ButtonApprove

        protected BaseButton m_ButtonApprove
        the Approve button.
      • m_ButtonDiscard

        protected BaseButton m_ButtonDiscard
        the Discard button.
      • m_ButtonCancel

        protected BaseButton m_ButtonCancel
        the Cancel button.
      • m_Option

        protected int m_Option
        the option selected by the user (CANCEL_OPTION, APPROVE_OPTION).
    • Constructor Detail

      • ApprovalDialog

        public ApprovalDialog​(Dialog owner)
        Creates a modeless dialog without a title with the specified Dialog as its owner.
        Parameters:
        owner - the owning dialog
      • ApprovalDialog

        public ApprovalDialog​(Dialog owner,
                              Dialog.ModalityType modality)
        Creates a dialog with the specified owner Dialog and modality.
        Parameters:
        owner - the owning dialog
        modality - the type of modality
      • ApprovalDialog

        public ApprovalDialog​(Dialog owner,
                              String title)
        Creates a modeless dialog with the specified title and with the specified owner dialog.
        Parameters:
        owner - the owning dialog
        title - the title of the dialog
      • ApprovalDialog

        public ApprovalDialog​(Dialog owner,
                              String title,
                              Dialog.ModalityType modality)
        Creates a dialog with the specified title, modality and the specified owner Dialog.
        Parameters:
        owner - the owning dialog
        title - the title of the dialog
        modality - the type of modality
      • ApprovalDialog

        public ApprovalDialog​(Frame owner)
        Creates a modeless dialog without a title with the specified Frame as its owner.
        Parameters:
        owner - the owning frame
      • ApprovalDialog

        public ApprovalDialog​(Frame owner,
                              boolean modal)
        Creates a dialog with the specified owner Frame, modality and an empty title.
        Parameters:
        owner - the owning frame
        modal - whether the dialog is modal or not
      • ApprovalDialog

        public ApprovalDialog​(Frame owner,
                              String title)
        Creates a modeless dialog with the specified title and with the specified owner frame.
        Parameters:
        owner - the owning frame
        title - the title of the dialog
      • ApprovalDialog

        public ApprovalDialog​(Frame owner,
                              String title,
                              boolean modal)
        Creates a dialog with the specified owner Frame, modality and title.
        Parameters:
        owner - the owning frame
        title - the title of the dialog
        modal - whether the dialog is modal or not
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class BaseDialog
      • getOption

        public int getOption()
        Returns whether the user approved or canceled the dialog.
        Returns:
        the result
        See Also:
        APPROVE_OPTION, CANCEL_OPTION
      • beforeShow

        protected void beforeShow()
        Hook method just before the dialog is made visible.
        Overrides:
        beforeShow in class BaseDialog
      • checkInput

        protected String checkInput()
        Hook method for the "approve" button. Button triggers only if this method returns null.

        Default implementation returns null.
        Returns:
        null if the input is valid, otherwise error message
      • getApproveButton

        public BaseButton getApproveButton()
        Returns the approve button.
        Returns:
        the button
      • setApproveVisible

        public void setApproveVisible​(boolean value)
        Sets the visbility of the approve button.
        Parameters:
        value - true if to display button
      • isApproveVisible

        public boolean isApproveVisible()
        Returns the visibility of the approve button.
        Returns:
        true if visible
      • setApproveEnabled

        public void setApproveEnabled​(boolean value)
        Sets the enabled state of the approve button.
        Parameters:
        value - true if to enable button
      • isApproveEnabled

        public boolean isApproveEnabled()
        Returns the enabled state of the approve button.
        Returns:
        true if enabled
      • setApproveCaption

        public void setApproveCaption​(String value)
        Sets the caption/text of the approve button.
        Parameters:
        value - the new text
      • getApproveCaption

        public String getApproveCaption()
        Returns the caption/text of the approve button.
        Returns:
        the current text
      • setApproveMnemonic

        public void setApproveMnemonic​(int value)
        Sets the mnemonic of the approve button.
        Parameters:
        value - the new mnemonic, e.g., KeyEvent.VK_O
      • getApproveMnemonic

        public int getApproveMnemonic()
        Returns the mnemonic of the approve button.
        Returns:
        the current mnemonic, e.g., KeyEvent.VK_O
      • approveDialog

        public boolean approveDialog()
        Clicks the approve button (if enabled and visible).
        Returns:
        true if clicked
      • getDiscardButton

        public BaseButton getDiscardButton()
        Returns the discard button.
        Returns:
        the button
      • setDiscardVisible

        public void setDiscardVisible​(boolean value)
        Sets the visbility of the discard button.
        Parameters:
        value - true if to display button
      • isDiscardVisible

        public boolean isDiscardVisible()
        Returns the visibility of the discard button.
        Returns:
        true if visible
      • setDiscardEnabled

        public void setDiscardEnabled​(boolean value)
        Sets the enabled state of the Discard button.
        Parameters:
        value - true if to enable button
      • isDiscardEnabled

        public boolean isDiscardEnabled()
        Returns the enabled state of the Discard button.
        Returns:
        true if enabled
      • setDiscardCaption

        public void setDiscardCaption​(String value)
        Sets the caption/text of the discard button.
        Parameters:
        value - the new text
      • getDiscardCaption

        public String getDiscardCaption()
        Returns the caption/text of the discard button.
        Returns:
        the current text
      • setDiscardMnemonic

        public void setDiscardMnemonic​(int value)
        Sets the mnemonic of the discard button.
        Parameters:
        value - the new mnemonic, e.g., KeyEvent.VK_D
      • getDiscardMnemonic

        public int getDiscardMnemonic()
        Returns the mnemonic of the discard button.
        Returns:
        the current mnemonic, e.g., KeyEvent.VK_D
      • discardDialog

        public boolean discardDialog()
        Clicks the discard button (if enabled and visible).
        Returns:
        true if clicked
      • getCancelButton

        public BaseButton getCancelButton()
        Returns the cancel button.
        Returns:
        the button
      • setCancelVisible

        public void setCancelVisible​(boolean value)
        Sets the visbility of the cancel button.
        Parameters:
        value - true if to display button
      • isCancelVisible

        public boolean isCancelVisible()
        Returns the visibility of the cancel button.
        Returns:
        true if visible
      • setCancelEnabled

        public void setCancelEnabled​(boolean value)
        Sets the enabled state of the cancel button.
        Parameters:
        value - true if to enable button
      • isCancelEnabled

        public boolean isCancelEnabled()
        Returns the enabled state of the cancel button.
        Returns:
        true if enabled
      • setCancelCaption

        public void setCancelCaption​(String value)
        Sets the caption/text of the Cancel button.
        Parameters:
        value - the new text
      • getCancelCaption

        public String getCancelCaption()
        Returns the caption/text of the Cancel button.
        Returns:
        the current text
      • setCancelMnemonic

        public void setCancelMnemonic​(int value)
        Sets the mnemonic of the Cancel button.
        Parameters:
        value - the new mnemonic, e.g., KeyEvent.VK_C
      • getCancelMnemonic

        public int getCancelMnemonic()
        Returns the mnemonic of the Cancel button.
        Returns:
        the current mnemonic, e.g., KeyEvent.VK_C
      • cancelDialog

        public boolean cancelDialog()
        Clicks the cancel button (if enabled and visible).
        Returns:
        true if clicked
      • getDialog

        public static ApprovalDialog getDialog​(Dialog owner)
        Returns a basic (modal) approval dialog (ok/cancel).
        Parameters:
        owner - the owner of the dialog
      • getDialog

        public static ApprovalDialog getDialog​(Dialog owner,
                                               Dialog.ModalityType modal)
        Returns a basic approval dialog (ok/cancel).
        Parameters:
        owner - the owner of the dialog
        modal - the modality of the dialog
      • getDialog

        public static ApprovalDialog getDialog​(Frame owner)
        Returns a basic (modal) approval dialog (ok/cancel).
        Parameters:
        owner - the owner of the dialog
      • getDialog

        public static ApprovalDialog getDialog​(Frame owner,
                                               boolean modal)
        Returns a basic (modal) approval dialog (ok/cancel).
        Parameters:
        owner - the owner of the dialog
        modal - whether to create a modal frame
      • getConfirmationDialog

        public static ApprovalDialog getConfirmationDialog​(Dialog owner)
        Returns a basic (modal) confirmation dialog (yes/no/cancel).
        Parameters:
        owner - the owner of the dialog
      • getConfirmationDialog

        public static ApprovalDialog getConfirmationDialog​(Dialog owner,
                                                           Dialog.ModalityType modal)
        Returns a basic confirmation dialog (yes/no/cancel).
        Parameters:
        owner - the owner of the dialog
        modal - the modality of the dialog
      • getConfirmationDialog

        public static ApprovalDialog getConfirmationDialog​(Frame owner)
        Returns a basic (modal) confirmation dialog (yes/no/cancel).
        Parameters:
        owner - the owner of the dialog
      • getConfirmationDialog

        public static ApprovalDialog getConfirmationDialog​(Frame owner,
                                                           boolean modal)
        Returns a basic confirmation dialog (yes/no/cancel).
        Parameters:
        owner - the owner of the dialog
        modal - whether to create a modal dialog
      • getInformationDialog

        public static ApprovalDialog getInformationDialog​(Dialog owner)
        Returns a basic (modal) info dialog (ok).
        Parameters:
        owner - the owner of the dialog
      • getInformationDialog

        public static ApprovalDialog getInformationDialog​(Dialog owner,
                                                          Dialog.ModalityType modal)
        Returns a basic info dialog (ok).
        Parameters:
        owner - the owner of the dialog
        modal - the modality of the dialog
      • getInformationDialog

        public static ApprovalDialog getInformationDialog​(Frame owner)
        Returns a basic (modal) info dialog (ok).
        Parameters:
        owner - the owner of the dialog
      • getInformationDialog

        public static ApprovalDialog getInformationDialog​(Frame owner,
                                                          boolean modal)
        Returns a basic info dialog (ok).
        Parameters:
        owner - the owner of the dialog
        modal - whether to create a modal dialog