Class StatusGenericPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.opends.guitools.controlpanel.ui.StatusGenericPanel
-
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,ConfigChangeListener
- Direct Known Subclasses:
AbstractNewEntryPanel,AddToGroupPanel,BackendIndexesPanel,BackendVLVIndexesPanel,BackupListPanel,BaseDNPanel,BinaryAttributeEditorPanel,BinaryValuePanel,BrowseEntriesPanel,DeleteBackendPanel,ErrorSearchingEntryPanel,InclusionExclusionPanel,IndexBrowserRightPanel,JavaInformationMonitoringPanel,JavaPropertiesPanel,LDAPEntryPanel,LDAPEntrySelectionPanel,LocalOrRemotePanel,LoginPanel,MainActionsPane,ManageTasksPanel,NewAttributePanel,NewBaseDNPanel,NewIndexPanel,NewObjectClassPanel,ObjectClassEditorPanel,RebuildIndexPanel,RefreshOptionsPanel,ResetUserPasswordPanel,SchemaBrowserRightPanel,SchemaElementPanel,SelectObjectClassesPanel,TaskToSchedulePanel,TreePanel,VerifyIndexPanel,ViewEntryPanel,VLVIndexPanel,WindowsServicePanel
public abstract class StatusGenericPanel extends JPanel implements ConfigChangeListener
An abstract class that contains a number of methods that are shared by all the inheriting classes. In general a StatusGenericPanel is contained in a GenericDialog and specifies the kind of buttons that this dialog has. The StatusGenericPanel is also notified when the dialog is displayed (through the toBeDisplayed method)- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classStatusGenericPanel.IgnoreItemListenerA class used to avoid the possibility a certain type of objects in a combo box.-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMBO_SEPARATORThe string to be used as combo separator.protected JEditorPaneerrorPaneThe error pane.protected static org.forgerock.i18n.LocalizableMessageNOT_APPLICABLEThe not applicable message.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStatusGenericPanel()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(Component comp, Object constraints)The components are not added directly to the panel but to the main panel.protected voidadd(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.protected voidaddBottomGlue(GridBagConstraints gbc)Adds a bottom glue to the main panel with the provided constraints.voidaddConfigurationElementCreatedListener(ConfigurationElementCreatedListener listener)Adds a configuration element created listener.protected voidaddErrorPane(Container p, GridBagConstraints baseGbc)Adds an error pane to the provided container.protected voidaddErrorPane(GridBagConstraints baseGbc)Creates and adds an error pane.protected voidaddScheduleErrors(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.protected booleanauthenticationRequired(ServerDescriptor desc)Returnstrueif the server is running and the user did not provide authentication andfalseotherwise.booleancallConfigurationChangedInBackground()This method is called to indicate that the configuration changes should be called in the background.voidcancelClicked()Notification that cancel was clicked, the panel is in charge of doing whatever is required (close the dialog, etc.).protected voidcheckCompatibleSuperiors(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.protected booleancheckIntValue(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.protected voidcheckOKButtonEnable()Updates the enabling/disabling of the OK button.voidcloseClicked()Notification that close was clicked, the panel is in charge of doing whatever is required (close the dialog, etc.).protected voidcomboBoxSelected(Map<String,SortedSet<AbstractIndexDescriptor>> hmIndexes, CategorizedComboBoxElement selectedItem, AddRemovePanel<AbstractIndexDescriptor> addRemove)Updates and addremove panel with the contents of the provided item.protected voidcreateErrorPane()Creates the error pane.protected JLabelcreateRequiredLabel()Returns a label with text 'Required Field' and an icon (used as legend in some panels).protected booleandisplayBackend(BackendDescriptor backend)Method that says if a backend must be displayed.protected booleandisplayConfirmationDialog(org.forgerock.i18n.LocalizableMessage title, org.forgerock.i18n.LocalizableMessage msg)Displays a confirmation message.protected voiddisplayErrorDialog(Collection<org.forgerock.i18n.LocalizableMessage> errors)Displays a dialog with the provided list of error messages.protected voiddisplayErrorMessage(org.forgerock.i18n.LocalizableMessage title, org.forgerock.i18n.LocalizableMessage msg)Displays an error message and hides the main panel.protected voiddisplayMainPanel()Displays the main panel.protected voiddisplayMessage(org.forgerock.i18n.LocalizableMessage msg)Displays a message and hides the main panel.protected booleanentryExists(DN dn)Tells whether an entry exists or not.protected StringgetAuthenticateHTML()Returns the HTML required to render an Authenticate button in HTML.GenericDialog.ButtonTypegetButtonType()Returns the buttons that the dialog where this panel is contained should display.protected List<ConfigurationElementCreatedListener>getConfigurationElementCreatedListeners()Returns the list of configuration listeners.ControlPanelInfogetInfo()Returns the control panel info object.protected static org.forgerock.i18n.LocalizableMessagegetLabel(MonitoringAttributes attr)Returns the label to be used in panels (with ':') based on the definition of the monitoring attribute.protected GenericDialoggetLoginDialog()Returns the login dialog that is displayed when the method authenticate is called.JMenuBargetMenuBar()Returns the menu bar that the panel might have.static StringgetMonitoringValue(MonitoringAttributes attr, SearchResultEntry monitoringEntry)Returns the monitoring value in a String form to be displayed to the user.abstract ComponentgetPreferredFocusComponent()Returns the component that should get the focus when the dialog that contains this panel is displayed.protected BordergetRightPanelBorder()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).protected List<String>getScheduleArgs(ScheduleType schedule)Returns the command-line arguments associated with the provided schedule.protected StringgetStartServerHTML()Returns the HTML required to render an Start button in HTML.abstract org.forgerock.i18n.LocalizableMessagegetTitle()Returns the title that will be used as title of the dialog.protected booleanhasObjectClass(DN dn, String... objectClasses)Tells whether a given entry exists and contains one of the specified object classes.protected booleanisBinary(String attrName)Returns whether the provided attribute name has binary syntax.protected booleanisCategory(Object o)Returnstrueif the provided object is a category object in a combo box.booleanisDisposeOnClose()Whether the dialog should be disposed when the user closes it.booleanisEnableCancel()Returnstrueif the cancel button is enabled andfalseotherwise.booleanisEnableClose()Returnstrueif the close button is enabled andfalseotherwise.booleanisEnableOK()Returnstrueif the ok button is enabled andfalseotherwise.protected booleanisLocal()Returnstrueif the managed server is the local installation (where the control panel is installed)falseotherwise.protected booleanisServerRunning()Returnstrueif the server is running andfalseotherwise.protected voidlaunchOperation(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.static voidlaunchOperation(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.abstract voidokClicked()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.).protected voidpackParentDialog()Packs the parent dialog.protected voidrebuildIndexIfNecessary(AbstractIndexDescriptor index, ProgressDialog progressDialog)If the index must be rebuilt, asks the user for confirmation.voidremoveConfigurationElementCreatedListener(ConfigurationElementCreatedListener listener)Removes a configuration element created listener.booleanrequiresBorder()Returnstrueif this panel requires some bordering (in general an EmptyBorder with some insets) andfalseotherwise.booleanrequiresScroll()Tells whether this panel should be contained in a scroll pane or not.protected voidrestartServer()Restarts the server.voidsetDisposeOnClose(boolean disposeOnClose)Sets whether the dialog should be disposed when the user closes it or not.protected voidsetEnabledCancel(boolean enable)Enables the Cancel button in the parent dialog.protected voidsetEnabledOK(boolean enable)Enables the OK button in the parent dialog.voidsetInfo(ControlPanelInfo info)Sets the control panel info object.protected voidsetPrimaryInvalid(JComponent comp)Updates the font type and color of the component to be invalid and primary.protected voidsetPrimaryValid(JComponent comp)Updates the font type and color of the component to be valid and primary.protected voidsetSecondaryInvalid(JComponent comp)Updates the font type and color of the component to be invalid and secondary.protected voidsetSecondaryValid(JComponent comp)Updates the font type and color of the component to be valid and secondary.protected voidstartServer()Starts the server.protected voidstopServer()Stops the server.voidtoBeDisplayed(boolean visible)The panel is notified that the dialog is going to be visible or invisible.protected voidupdateBaseDNComboBoxModel(DefaultComboBoxModel model, ServerDescriptor desc)Commodity method to update a combo box model with the backends of a server.protected voidupdateComboBoxModel(Collection<?> newElements, DefaultComboBoxModel model)Updates a combo box model with a number of items.protected voidupdateConfirmationPane(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.protected voidupdateErrorPane(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.protected voidupdateErrorPaneAndOKButtonIfAuthRequired(ServerDescriptor desc, org.forgerock.i18n.LocalizableMessage details)Updates the error panel and enables/disables the OK button depending on the status of the server.protected voidupdateErrorPaneIfAuthRequired(ServerDescriptor desc, org.forgerock.i18n.LocalizableMessage details)Updates the error panel depending on the status of the server.protected voidupdateErrorPaneIfServerRunningAndAuthRequired(ServerDescriptor desc, org.forgerock.i18n.LocalizableMessage detailsServerNotRunning, org.forgerock.i18n.LocalizableMessage authRequired)Updates the error panel depending on the status of the server.protected voidupdateIndexMap(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.protected voidupdateMonitoringInfo(List<? extends MonitoringAttributes> monitoringAttrs, List<JLabel> monitoringLabels, SearchResultEntry monitoringEntry)Updates the monitoring information writing it to a list of labels.protected voidupdateSimpleBackendComboBoxModel(JComboBox combo, JLabel lNoBackendsFound, ServerDescriptor desc)Commodity method used to update the elements of a combo box that contains the different user backends.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.opends.guitools.controlpanel.event.ConfigChangeListener
configurationChanged
-
-
-
-
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.
-
-
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()
Returnstrueif this panel requires some bordering (in general an EmptyBorder with some insets) andfalseotherwise.- Returns:
trueif this panel requires some bordering (in general an EmptyBorder with some insets) andfalseotherwise.
-
getMenuBar
public JMenuBar getMenuBar()
Returns the menu bar that the panel might have. Returnsnullif 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 returnstrueand the operation will be performed in the background while a message of type 'Loading...' is displayed on the panel.- Returns:
trueif changes should be loaded in the background andfalseotherwise.
-
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:
trueif this panel should be contained in a scroll pane andfalseotherwise.
-
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.
-
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:
trueif the dialog should be disposed when the user closes it ortrueotherwise.
-
setDisposeOnClose
public void setDisposeOnClose(boolean disposeOnClose)
Sets whether the dialog should be disposed when the user closes it or not.- Parameters:
disposeOnClose-trueif the dialog should be disposed when the user closes it ortrueotherwise.
-
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:
trueif the user confirms andfalseotherwise.
-
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)
Returnstrueif the server is running and the user did not provide authentication andfalseotherwise.- Parameters:
desc- the server descriptor.- Returns:
trueif the server is running and the user did not provide authentication andfalseotherwise.
-
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)
Returnstrueif the provided object is a category object in a combo box.- Parameters:
o- the item in the combo box.- Returns:
trueif 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:
trueif the provided attribute name has binary syntax,falseotherwise.
-
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:
trueif the backend must be displayed andfalseotherwise.
-
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.
-
comboBoxSelected
protected void comboBoxSelected(Map<String,SortedSet<AbstractIndexDescriptor>> hmIndexes, CategorizedComboBoxElement selectedItem, AddRemovePanel<AbstractIndexDescriptor> addRemove)
Updates and addremove panel with the contents of the provided item. The selected item represents a base DN.- Parameters:
hmIndexes- the map that contains the indexes definitions as values and the base DNs as keys.selectedItem- the selected item.addRemove- the add remove panel to be updated.
-
isEnableCancel
public boolean isEnableCancel()
Returnstrueif the cancel button is enabled andfalseotherwise.- Returns:
trueif the cancel button is enabled andfalseotherwise.
-
isEnableClose
public boolean isEnableClose()
Returnstrueif the close button is enabled andfalseotherwise.- Returns:
trueif the close button is enabled andfalseotherwise.
-
isEnableOK
public boolean isEnableOK()
Returnstrueif the ok button is enabled andfalseotherwise.- Returns:
trueif the ok button is enabled andfalseotherwise.
-
isServerRunning
protected boolean isServerRunning()
Returnstrueif the server is running andfalseotherwise.- Returns:
trueif the server is running andfalseotherwise.
-
isLocal
protected boolean isLocal()
Returnstrueif the managed server is the local installation (where the control panel is installed)falseotherwise.- Returns:
trueif the managed server is the local installation (where the control panel is installed)falseotherwise.
-
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:
trueif 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:
trueif the entry with the provided DN could be found,falseotherwise.
-
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:
trueif the entry exists and contains one of the specified object classes,falseotherwise.
-
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.
-
-