Class StatusGenericPanel

    • Field Detail

      • COMBO_SEPARATOR

        public static final String COMBO_SEPARATOR
        The string to be used as combo separator.
        See Also:
        Constant Field Values
      • NOT_APPLICABLE

        protected static final org.forgerock.i18n.LocalizableMessage NOT_APPLICABLE
        The not applicable message.
      • errorPane

        protected JEditorPane errorPane
        The error pane.
    • Constructor Detail

      • StatusGenericPanel

        protected StatusGenericPanel()
        Constructor.
    • Method Detail

      • getTitle

        public abstract org.forgerock.i18n.LocalizableMessage getTitle()
        Returns the title that will be used as title of the dialog.
        Returns:
        the title that will be used as title of the dialog.
      • getButtonType

        public GenericDialog.ButtonType getButtonType()
        Returns the buttons that the dialog where this panel is contained should display.
        Returns:
        the buttons that the dialog where this panel is contained should display.
      • getPreferredFocusComponent

        public abstract Component getPreferredFocusComponent()
        Returns the component that should get the focus when the dialog that contains this panel is displayed.
        Returns:
        the component that should get the focus.
      • requiresBorder

        public boolean requiresBorder()
        Returns true if this panel requires some bordering (in general an EmptyBorder with some insets) and false otherwise.
        Returns:
        true if this panel requires some bordering (in general an EmptyBorder with some insets) and false otherwise.
      • getMenuBar

        public JMenuBar getMenuBar()
        Returns the menu bar that the panel might have. Returns null if the panel has no menu bar associated.
        Returns:
        the menu bar that the panel might have.
      • callConfigurationChangedInBackground

        public boolean callConfigurationChangedInBackground()
        This method is called to indicate that the configuration changes should be called in the background. In the case of panels which require some time to be updated with the new configuration this method returns true and the operation will be performed in the background while a message of type 'Loading...' is displayed on the panel.
        Returns:
        true if changes should be loaded in the background and false otherwise.
      • toBeDisplayed

        public void toBeDisplayed​(boolean visible)
        The panel is notified that the dialog is going to be visible or invisible.
        Parameters:
        visible - whether is going to be visible or not.
      • requiresScroll

        public boolean requiresScroll()
        Tells whether this panel should be contained in a scroll pane or not.
        Returns:
        true if this panel should be contained in a scroll pane and false otherwise.
      • add

        public void add​(Component comp,
                        Object constraints)
        The components are not added directly to the panel but to the main panel. This is done to be able to display a message that takes the whole panel (of type 'Loading...') when we are doing long operations.
        Overrides:
        add in class Container
        Parameters:
        comp - the Component to be added.
        constraints - the constraints.
      • addBottomGlue

        protected void addBottomGlue​(GridBagConstraints gbc)
        Adds a bottom glue to the main panel with the provided constraints.
        Parameters:
        gbc - the constraints.
      • createRequiredLabel

        protected JLabel createRequiredLabel()
        Returns a label with text 'Required Field' and an icon (used as legend in some panels).
        Returns:
        a label with text 'Required Field' and an icon (used as legend in some panels).
      • addErrorPane

        protected void addErrorPane​(GridBagConstraints baseGbc)
        Creates and adds an error pane. Is up to the caller to set the proper gridheight, gridwidth, gridx and gridy on the provided GridBagConstraints.
        Parameters:
        baseGbc - the GridBagConstraints to be used.
      • addErrorPane

        protected void addErrorPane​(Container p,
                                    GridBagConstraints baseGbc)
        Adds an error pane to the provided container. Is up to the caller to set the proper gridheight, gridwidth, gridx and gridy on the provided GridBagConstraints.
        Parameters:
        baseGbc - the GridBagConstraints to be used.
        p - the container.
      • createErrorPane

        protected void createErrorPane()
        Creates the error pane.
      • add

        protected void add​(JLabel[] labels,
                           Component[] comps,
                           JLabel[] inlineHelp,
                           Container panel,
                           GridBagConstraints gbc)
        Commodity method used to add lines, where each line contains a label, a component and an inline help label.
        Parameters:
        labels - the labels.
        comps - the components.
        inlineHelp - the inline help labels.
        panel - the panel where we will add the lines.
        gbc - the grid bag constraints.
      • setEnabledOK

        protected void setEnabledOK​(boolean enable)
        Enables the OK button in the parent dialog.
        Parameters:
        enable - whether to enable or disable the button.
      • setEnabledCancel

        protected void setEnabledCancel​(boolean enable)
        Enables the Cancel button in the parent dialog.
        Parameters:
        enable - whether to enable or disable the button.
      • setPrimaryInvalid

        protected void setPrimaryInvalid​(JComponent comp)
        Updates the font type and color of the component to be invalid and primary.
        Parameters:
        comp - the component to update.
      • setPrimaryValid

        protected void setPrimaryValid​(JComponent comp)
        Updates the font type and color of the component to be valid and primary.
        Parameters:
        comp - the component to update.
      • setSecondaryInvalid

        protected void setSecondaryInvalid​(JComponent comp)
        Updates the font type and color of the component to be invalid and secondary.
        Parameters:
        comp - the component to update.
      • setSecondaryValid

        protected void setSecondaryValid​(JComponent comp)
        Updates the font type and color of the component to be valid and secondary.
        Parameters:
        comp - the component to update.
      • packParentDialog

        protected void packParentDialog()
        Packs the parent dialog.
      • okClicked

        public abstract void okClicked()
        Notification that the ok button has been clicked, the panel is in charge of doing whatever is required (close the dialog, launch a task, etc.).
      • addConfigurationElementCreatedListener

        public void addConfigurationElementCreatedListener​(ConfigurationElementCreatedListener listener)
        Adds a configuration element created listener.
        Parameters:
        listener - the listener.
      • removeConfigurationElementCreatedListener

        public void removeConfigurationElementCreatedListener​(ConfigurationElementCreatedListener listener)
        Removes a configuration element created listener.
        Parameters:
        listener - the listener.
      • getConfigurationElementCreatedListeners

        protected List<ConfigurationElementCreatedListener> getConfigurationElementCreatedListeners()
        Returns the list of configuration listeners.
        Returns:
        the list of configuration listeners.
      • cancelClicked

        public void cancelClicked()
        Notification that cancel was clicked, the panel is in charge of doing whatever is required (close the dialog, etc.).
      • isDisposeOnClose

        public boolean isDisposeOnClose()
        Whether the dialog should be disposed when the user closes it.
        Returns:
        true if the dialog should be disposed when the user closes it or true otherwise.
      • setDisposeOnClose

        public void setDisposeOnClose​(boolean disposeOnClose)
        Sets whether the dialog should be disposed when the user closes it or not.
        Parameters:
        disposeOnClose - true if the dialog should be disposed when the user closes it or true otherwise.
      • closeClicked

        public void closeClicked()
        Notification that close was clicked, the panel is in charge of doing whatever is required (close the dialog, etc.).
      • displayErrorDialog

        protected void displayErrorDialog​(Collection<org.forgerock.i18n.LocalizableMessage> errors)
        Displays a dialog with the provided list of error messages.
        Parameters:
        errors - the error messages.
      • displayConfirmationDialog

        protected boolean displayConfirmationDialog​(org.forgerock.i18n.LocalizableMessage title,
                                                    org.forgerock.i18n.LocalizableMessage msg)
        Displays a confirmation message.
        Parameters:
        title - the title/summary of the message.
        msg - the description of the confirmation.
        Returns:
        true if the user confirms and false otherwise.
      • rebuildIndexIfNecessary

        protected void rebuildIndexIfNecessary​(AbstractIndexDescriptor index,
                                               ProgressDialog progressDialog)
        If the index must be rebuilt, asks the user for confirmation. If the user confirms launches a task that will rebuild the indexes. The progress will be displayed in the provided progress dialog.
        Parameters:
        index - the index.
        progressDialog - the progress dialog.
      • getAuthenticateHTML

        protected String getAuthenticateHTML()
        Returns the HTML required to render an Authenticate button in HTML.
        Returns:
        the HTML required to render an Authenticate button in HTML.
      • getStartServerHTML

        protected String getStartServerHTML()
        Returns the HTML required to render an Start button in HTML.
        Returns:
        the HTML required to render an Start button in HTML.
      • updateErrorPaneAndOKButtonIfAuthRequired

        protected void updateErrorPaneAndOKButtonIfAuthRequired​(ServerDescriptor desc,
                                                                org.forgerock.i18n.LocalizableMessage details)
        Updates the error panel and enables/disables the OK button depending on the status of the server.
        Parameters:
        desc - the Server Descriptor.
        details - the message to be displayed if authentication has not been provided and the server is running.
      • authenticationRequired

        protected boolean authenticationRequired​(ServerDescriptor desc)
        Returns true if the server is running and the user did not provide authentication and false otherwise.
        Parameters:
        desc - the server descriptor.
        Returns:
        true if the server is running and the user did not provide authentication and false otherwise.
      • updateErrorPaneIfAuthRequired

        protected void updateErrorPaneIfAuthRequired​(ServerDescriptor desc,
                                                     org.forgerock.i18n.LocalizableMessage details)
        Updates the error panel depending on the status of the server.
        Parameters:
        desc - the Server Descriptor.
        details - the message to be displayed if authentication has not been provided and the server is running.
      • updateErrorPaneIfServerRunningAndAuthRequired

        protected void updateErrorPaneIfServerRunningAndAuthRequired​(ServerDescriptor desc,
                                                                     org.forgerock.i18n.LocalizableMessage detailsServerNotRunning,
                                                                     org.forgerock.i18n.LocalizableMessage authRequired)
        Updates the error panel depending on the status of the server. This method will display an error message in the error pane if the server is not running and another message if the server is running but authentication has not been provided.
        Parameters:
        desc - the Server Descriptor.
        detailsServerNotRunning - the message to be displayed if the server is not running.
        authRequired - the message to be displayed if authentication has not been provided and the server is running.
      • checkOKButtonEnable

        protected void checkOKButtonEnable()
        Updates the enabling/disabling of the OK button. The code assumes that the error pane has already been updated.
      • isCategory

        protected boolean isCategory​(Object o)
        Returns true if the provided object is a category object in a combo box.
        Parameters:
        o - the item in the combo box.
        Returns:
        true if the provided object is a category object in a combo box.
      • isBinary

        protected boolean isBinary​(String attrName)
        Returns whether the provided attribute name has binary syntax.
        Parameters:
        attrName - the attribute name.
        Returns:
        true if the provided attribute name has binary syntax, false otherwise.
      • getInfo

        public ControlPanelInfo getInfo()
        Returns the control panel info object.
        Returns:
        the control panel info object.
      • setInfo

        public void setInfo​(ControlPanelInfo info)
        Sets the control panel info object.
        Parameters:
        info - the control panel info object.
      • displayMainPanel

        protected void displayMainPanel()
        Displays the main panel.
      • displayMessage

        protected void displayMessage​(org.forgerock.i18n.LocalizableMessage msg)
        Displays a message and hides the main panel.
        Parameters:
        msg - the message to be displayed.
      • displayErrorMessage

        protected void displayErrorMessage​(org.forgerock.i18n.LocalizableMessage title,
                                           org.forgerock.i18n.LocalizableMessage msg)
        Displays an error message and hides the main panel.
        Parameters:
        title - the title of the message to be displayed.
        msg - the message to be displayed.
      • updateErrorPane

        protected void updateErrorPane​(JEditorPane pane,
                                       org.forgerock.i18n.LocalizableMessage title,
                                       Font titleFont,
                                       org.forgerock.i18n.LocalizableMessage details,
                                       Font detailsFont)
        Updates the contents of an editor pane using the error format.
        Parameters:
        pane - the editor pane to be updated.
        title - the title.
        titleFont - the font to be used for the title.
        details - the details message.
        detailsFont - the font to be used for the details.
      • updateConfirmationPane

        protected void updateConfirmationPane​(JEditorPane pane,
                                              org.forgerock.i18n.LocalizableMessage title,
                                              Font titleFont,
                                              org.forgerock.i18n.LocalizableMessage details,
                                              Font detailsFont)
        Updates the contents of an editor pane using the confirmation format.
        Parameters:
        pane - the editor pane to be updated.
        title - the title.
        titleFont - the font to be used for the title.
        details - the details message.
        detailsFont - the font to be used for the details.
      • updateSimpleBackendComboBoxModel

        protected void updateSimpleBackendComboBoxModel​(JComboBox combo,
                                                        JLabel lNoBackendsFound,
                                                        ServerDescriptor desc)
        Commodity method used to update the elements of a combo box that contains the different user backends. If no backends are found the combo box will be made invisible and a label will be made visible. This method does not update the label's text nor creates any layout.
        Parameters:
        combo - the combo to be updated.
        lNoBackendsFound - the label that must be shown if no user backends are found.
        desc - the server descriptor that contains the configuration.
      • displayBackend

        protected boolean displayBackend​(BackendDescriptor backend)
        Method that says if a backend must be displayed. Only non-config backends are displayed.
        Parameters:
        backend - the backend.
        Returns:
        true if the backend must be displayed and false otherwise.
      • updateBaseDNComboBoxModel

        protected void updateBaseDNComboBoxModel​(DefaultComboBoxModel model,
                                                 ServerDescriptor desc)
        Commodity method to update a combo box model with the backends of a server.
        Parameters:
        model - the combo box model to be updated.
        desc - the server descriptor containing the configuration.
      • updateComboBoxModel

        protected void updateComboBoxModel​(Collection<?> newElements,
                                           DefaultComboBoxModel model)
        Updates a combo box model with a number of items.
        Parameters:
        newElements - the new items for the combo box model.
        model - the combo box model to be updated.
      • updateIndexMap

        protected void updateIndexMap​(ServerDescriptor desc,
                                      Map<String,​SortedSet<AbstractIndexDescriptor>> hmIndexes)
        Updates a map, so that the keys are the base DN where the indexes are defined and the values are a sorted set of indexes.
        Parameters:
        desc - the server descriptor containing the index configuration.
        hmIndexes - the map to be updated.
      • isEnableCancel

        public boolean isEnableCancel()
        Returns true if the cancel button is enabled and false otherwise.
        Returns:
        true if the cancel button is enabled and false otherwise.
      • isEnableClose

        public boolean isEnableClose()
        Returns true if the close button is enabled and false otherwise.
        Returns:
        true if the close button is enabled and false otherwise.
      • isEnableOK

        public boolean isEnableOK()
        Returns true if the ok button is enabled and false otherwise.
        Returns:
        true if the ok button is enabled and false otherwise.
      • isServerRunning

        protected boolean isServerRunning()
        Returns true if the server is running and false otherwise.
        Returns:
        true if the server is running and false otherwise.
      • isLocal

        protected boolean isLocal()
        Returns true if the managed server is the local installation (where the control panel is installed) false otherwise.
        Returns:
        true if the managed server is the local installation (where the control panel is installed) false otherwise.
      • launchOperation

        protected void launchOperation​(Task task,
                                       org.forgerock.i18n.LocalizableMessage initialSummary,
                                       org.forgerock.i18n.LocalizableMessage successSummary,
                                       org.forgerock.i18n.LocalizableMessage successDetail,
                                       org.forgerock.i18n.LocalizableMessage errorSummary,
                                       org.forgerock.i18n.LocalizableMessage errorDetail,
                                       org.forgerock.i18n.LocalizableMessageDescriptor.Arg1<Number> errorDetailCode,
                                       ProgressDialog dialog)
        Launch an task.
        Parameters:
        task - the task to be launched.
        initialSummary - the initial summary to be displayed in the progress dialog.
        successSummary - the success summary to be displayed in the progress dialog if the task is successful.
        successDetail - the success details to be displayed in the progress dialog if the task is successful.
        errorSummary - the error summary to be displayed in the progress dialog if the task ended with error.
        errorDetail - error details to be displayed in the progress dialog if the task ended with error.
        errorDetailCode - error detail message to be displayed in the progress dialog if the task ended with error and we have an exit error code (for instance if the error occurred when launching a script we will have an error code).
        dialog - the progress dialog.
      • launchOperation

        public static void launchOperation​(Task task,
                                           org.forgerock.i18n.LocalizableMessage initialSummary,
                                           org.forgerock.i18n.LocalizableMessage successSummary,
                                           org.forgerock.i18n.LocalizableMessage successDetail,
                                           org.forgerock.i18n.LocalizableMessage errorSummary,
                                           org.forgerock.i18n.LocalizableMessage errorDetail,
                                           org.forgerock.i18n.LocalizableMessageDescriptor.Arg1<Number> errorDetailCode,
                                           ProgressDialog dialog,
                                           boolean resetLogs,
                                           ControlPanelInfo info)
        Launch an task.
        Parameters:
        task - the task to be launched.
        initialSummary - the initial summary to be displayed in the progress dialog.
        successSummary - the success summary to be displayed in the progress dialog if the task is successful.
        successDetail - the success details to be displayed in the progress dialog if the task is successful.
        errorSummary - the error summary to be displayed in the progress dialog if the task ended with error.
        errorDetail - error details to be displayed in the progress dialog if the task ended with error.
        errorDetailCode - error detail message to be displayed in the progress dialog if the task ended with error and we have an exit error code (for instance if the error occurred when launching a script we will have an error code).
        dialog - the progress dialog.
        resetLogs - whether the contents of the progress dialog should be reset or not.
        info - the ControlPanelInfo.
      • checkIntValue

        protected boolean checkIntValue​(Collection<org.forgerock.i18n.LocalizableMessage> errors,
                                        String stringValue,
                                        int minValue,
                                        int maxValue,
                                        org.forgerock.i18n.LocalizableMessage errMsg)
        Checks that the provided string value is a valid integer and if it is not updates a list of error messages with an error.
        Parameters:
        errors - the list of error messages to be updated.
        stringValue - the string value to analyze.
        minValue - the minimum integer value accepted.
        maxValue - the maximum integer value accepted.
        errMsg - the error message to use to update the error list if the provided value is not valid.
        Returns:
        true if the provided string value is a valid integer and if it is not updates a list of error messages with an error.
      • startServer

        protected void startServer()
        Starts the server. This method will launch a task and open a progress dialog that will start the server. This method must be called from the event thread.
      • stopServer

        protected void stopServer()
        Stops the server. This method will launch a task and open a progress dialog that will stop the server. This method must be called from the event thread.
      • restartServer

        protected void restartServer()
        Restarts the server. This method will launch a task and open a progress dialog that will restart the server. This method must be called from the event thread.
      • getLoginDialog

        protected GenericDialog getLoginDialog()
        Returns the login dialog that is displayed when the method authenticate is called.
        Returns:
        the login dialog that is displayed when the method authenticate is called.
      • entryExists

        protected boolean entryExists​(DN dn)
        Tells whether an entry exists or not. Actually it tells if we could find a given entry or not.
        Parameters:
        dn - the DN of the entry to look for.
        Returns:
        true if the entry with the provided DN could be found, false otherwise.
      • hasObjectClass

        protected boolean hasObjectClass​(DN dn,
                                         String... objectClasses)
        Tells whether a given entry exists and contains one of the specified object classes.
        Parameters:
        dn - the DN of the entry.
        objectClasses - the object classes to check.
        Returns:
        true if the entry exists and contains one of the specified object classes, false otherwise.
      • getRightPanelBorder

        protected Border getRightPanelBorder()
        Returns the border to be used in the right panel of the dialog with a tree on the left (for instance the schema browser, entry browser and index browser).
        Returns:
        the border to be used in the right panel.
      • getMonitoringValue

        public static String getMonitoringValue​(MonitoringAttributes attr,
                                                SearchResultEntry monitoringEntry)
        Returns the monitoring value in a String form to be displayed to the user.
        Parameters:
        attr - the attribute to analyze.
        monitoringEntry - the monitoring entry.
        Returns:
        the monitoring value in a String form to be displayed to the user.
      • updateMonitoringInfo

        protected void updateMonitoringInfo​(List<? extends MonitoringAttributes> monitoringAttrs,
                                            List<JLabel> monitoringLabels,
                                            SearchResultEntry monitoringEntry)
        Updates the monitoring information writing it to a list of labels.
        Parameters:
        monitoringAttrs - the monitoring operations whose information we want to update.
        monitoringLabels - the monitoring labels to be updated.
        monitoringEntry - the monitoring entry containing the information to be displayed.
      • getLabel

        protected static org.forgerock.i18n.LocalizableMessage getLabel​(MonitoringAttributes attr)
        Returns the label to be used in panels (with ':') based on the definition of the monitoring attribute.
        Parameters:
        attr - the monitoring attribute.
        Returns:
        the label to be used in panels (with ':') based on the definition of the monitoring attribute.
      • getScheduleArgs

        protected List<String> getScheduleArgs​(ScheduleType schedule)
        Returns the command-line arguments associated with the provided schedule.
        Parameters:
        schedule - the schedule.
        Returns:
        the command-line arguments associated with the provided schedule.
      • addScheduleErrors

        protected void addScheduleErrors​(ScheduleType schedule,
                                         Collection<org.forgerock.i18n.LocalizableMessage> errors,
                                         JLabel label)
        Checks whether the server is running or not and depending on the schedule updates the list of errors with the errors found.
        Parameters:
        schedule - the schedule.
        errors - the list of errors.
        label - the label to be marked as invalid if errors where encountered.
      • checkCompatibleSuperiors

        protected void checkCompatibleSuperiors​(Set<ObjectClass> objectClassSuperiors,
                                                ObjectClassType objectClassType,
                                                List<org.forgerock.i18n.LocalizableMessage> errors)
        Checks whether the provided superior object classes are compatible with the provided object class type. If not, the method updates the provided list of error messages with a message describing the incompatibility.
        Parameters:
        objectClassSuperiors - the superior object classes.
        objectClassType - the object class type.
        errors - the list of error messages.