| | |
| | | import org.opends.messages.MessageBuilder; |
| | | import org.opends.messages.MessageDescriptor; |
| | | import org.opends.quicksetup.ui.CustomHTMLEditorKit; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | |
| | | private boolean disposeOnClose = false; |
| | | |
| | | private JPanel mainPanel; |
| | | private JLabel message; |
| | | |
| | | private GenericDialog loginDialog; |
| | | private JEditorPane message; |
| | | |
| | | /** |
| | | * The error pane. |
| | |
| | | mainPanel = new JPanel(new GridBagLayout()); |
| | | mainPanel.setOpaque(false); |
| | | |
| | | message = Utilities.createDefaultLabel(); |
| | | message = Utilities.makeHtmlPane("", ColorAndFontConstants.progressFont); |
| | | |
| | | GridBagConstraints gbc = new GridBagConstraints(); |
| | | gbc.gridx = 0; |
| | |
| | | } |
| | | else |
| | | { |
| | | rebuildIndexes = Utilities.displayConfirmationDialog(progressDialog, |
| | | INFO_CTRL_PANEL_INDEX_REBUILD_REQUIRED_SUMMARY.get(), |
| | | INFO_CTRL_PANEL_INDEX_REBUILD_REQUIRED_ONLINE_DETAILS.get( |
| | | index.getName(), backendName, backendName)); |
| | | if (isLocal() || true) |
| | | { |
| | | rebuildIndexes = Utilities.displayConfirmationDialog(progressDialog, |
| | | INFO_CTRL_PANEL_INDEX_REBUILD_REQUIRED_SUMMARY.get(), |
| | | INFO_CTRL_PANEL_INDEX_REBUILD_REQUIRED_ONLINE_DETAILS.get( |
| | | index.getName(), backendName, backendName)); |
| | | } |
| | | else |
| | | { |
| | | Utilities.displayWarningDialog(progressDialog, |
| | | INFO_CTRL_PANEL_INDEX_REBUILD_REQUIRED_SUMMARY.get(), |
| | | INFO_CTRL_PANEL_INDEX_REBUILD_REQUIRED_REMOTE_DETAILS.get( |
| | | index.getName(), backendName)); |
| | | rebuildIndexes = false; |
| | | } |
| | | } |
| | | if (rebuildIndexes) |
| | | { |
| | |
| | | { |
| | | boolean returnValue; |
| | | ServerDescriptor.ServerStatus status = desc.getStatus(); |
| | | if ((status == ServerDescriptor.ServerStatus.STARTED) && |
| | | !desc.isAuthenticated()) |
| | | if (((status == ServerDescriptor.ServerStatus.STARTED) && |
| | | !desc.isAuthenticated()) || |
| | | (status == ServerDescriptor.ServerStatus.NOT_CONNECTED_TO_REMOTE)) |
| | | { |
| | | returnValue = true; |
| | | } |
| | |
| | | Message authRequired) |
| | | { |
| | | ServerDescriptor.ServerStatus status = desc.getStatus(); |
| | | if (status != ServerDescriptor.ServerStatus.STARTED) |
| | | if ((status != ServerDescriptor.ServerStatus.STARTED) && |
| | | (status != ServerDescriptor.ServerStatus.NOT_CONNECTED_TO_REMOTE)) |
| | | { |
| | | Message title = INFO_CTRL_PANEL_SERVER_NOT_RUNNING_SUMMARY.get(); |
| | | MessageBuilder mb = new MessageBuilder(); |
| | |
| | | displayMessage(INFO_CTRL_PANEL_LOADING_PANEL_SUMMARY.get()); |
| | | worker.startBackgroundTask(); |
| | | } |
| | | else |
| | | else if (info.getServerDescriptor() != null) |
| | | { |
| | | configurationChanged(new ConfigurationChangeEvent( |
| | | this.info, this.info.getServerDescriptor())); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns whether the main panel is visible or not. |
| | | * @return whether the main panel is visible or not. |
| | | */ |
| | | protected boolean isMainPanelVisible() |
| | | { |
| | | return mainPanel.isVisible(); |
| | | } |
| | | |
| | | /** |
| | | * Displays a message and hides the main panel. |
| | | * @param msg the message to be displayed. |
| | | */ |
| | | protected void displayMessage(Message msg) |
| | | { |
| | | message.setText(msg.toString()); |
| | | message.setText(Utilities.applyFont(msg.toString(), |
| | | ColorAndFontConstants.progressFont)); |
| | | mainPanel.setVisible(false); |
| | | message.setVisible(true); |
| | | } |
| | | |
| | | /** |
| | | * Displays an error message and hides the main panel. |
| | | * @param title the title of the message to be displayed. |
| | | * @param msg the message to be displayed. |
| | | */ |
| | | protected void displayErrorMessage(Message title, Message msg) |
| | | { |
| | | updateErrorPane(message, title, ColorAndFontConstants.errorTitleFont, |
| | | msg, ColorAndFontConstants.defaultFont); |
| | | mainPanel.setVisible(false); |
| | | message.setVisible(true); |
| | | } |
| | | |
| | | /** |
| | | * Returns whether the message is visible or not. |
| | | * @return whether the message is visible or not. |
| | | */ |
| | | protected boolean isMessageVisible() |
| | | { |
| | | return message.isVisible(); |
| | | } |
| | | |
| | | /** |
| | | * Updates the contents of an editor pane using the error format. |
| | | * @param pane the editor pane to be updated. |
| | | * @param title the title. |
| | |
| | | * @param detailsFont the font to be used for the details. |
| | | * @param type the type of panel. |
| | | */ |
| | | private void updatePane(JEditorPane pane, Message title, |
| | | private void updatePane(final JEditorPane pane, Message title, |
| | | Font titleFont, Message details, Font detailsFont, PanelType type) |
| | | { |
| | | String text; |
| | |
| | | ServerConstants.EOL); |
| | | Utilities.updatePreferredSize(pane2, 100, plainText, detailsFont, true); |
| | | Dimension d2 = pane2.getPreferredSize(); |
| | | pane.setText(text); |
| | | pane.setPreferredSize(new Dimension(Math.max(d1.width, d2.width), |
| | | d1.height + d2.height)); |
| | | |
| | | lastDisplayedError = text; |
| | | pane.setText(text); |
| | | } |
| | | final Window window = |
| | | Utilities.getParentDialog(StatusGenericPanel.this); |
| | |
| | | */ |
| | | public void run() |
| | | { |
| | | pane.invalidate(); |
| | | window.validate(); |
| | | } |
| | | }); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if the managed server is the local installation |
| | | * (where the control panel is installed) <CODE>false</CODE> otherwise. |
| | | * @return <CODE>true</CODE> if the managed server is the local installation |
| | | * (where the control panel is installed) <CODE>false</CODE> otherwise. |
| | | */ |
| | | protected boolean isLocal() |
| | | { |
| | | return getInfo().getServerDescriptor().isLocal(); |
| | | } |
| | | |
| | | /** |
| | | * Launch an task. |
| | | * @param task the task to be launched. |
| | | * @param initialSummary the initial summary to be displayed in the progress |
| | |
| | | if ((task.getReturnCode() != null) && |
| | | (errorDetailCode != null)) |
| | | { |
| | | String sThrowable; |
| | | if (t instanceof OpenDsException) |
| | | { |
| | | sThrowable = ((OpenDsException)t).getMessageObject().toString(); |
| | | } |
| | | else |
| | | { |
| | | if (t.getMessage() != null) |
| | | { |
| | | sThrowable = t.getMessage(); |
| | | } |
| | | else |
| | | { |
| | | sThrowable = t.toString(); |
| | | } |
| | | } |
| | | MessageBuilder mb = new MessageBuilder(); |
| | | mb.append(errorDetailCode.get(task.getReturnCode())); |
| | | mb.append( |
| | | " "+INFO_CTRL_PANEL_DETAILS_THROWABLE.get(t.toString())); |
| | | " "+INFO_CTRL_PANEL_DETAILS_THROWABLE.get(sThrowable)); |
| | | summaryMsg = Utilities.getFormattedError(errorSummary, |
| | | ColorAndFontConstants.errorTitleFont, |
| | | mb.toMessage(), ColorAndFontConstants.defaultFont); |
| | |
| | | */ |
| | | protected GenericDialog getLoginDialog() |
| | | { |
| | | if (loginDialog == null) |
| | | if (isLocal()) |
| | | { |
| | | LoginPanel loginPanel = new LoginPanel(); |
| | | loginDialog = new GenericDialog(Utilities.getFrame(this), loginPanel); |
| | | loginPanel.setInfo(getInfo()); |
| | | GenericDialog loginDialog = |
| | | ControlCenterMainPane.getLocalServerLoginDialog(getInfo()); |
| | | Utilities.centerGoldenMean(loginDialog, Utilities.getFrame(this)); |
| | | loginDialog.setModal(true); |
| | | return loginDialog; |
| | | } |
| | | return loginDialog; |
| | | else |
| | | { |
| | | GenericDialog localOrRemoteDialog = |
| | | ControlCenterMainPane.getLocalOrRemoteDialog(getInfo()); |
| | | Utilities.centerGoldenMean(localOrRemoteDialog, Utilities.getFrame(this)); |
| | | localOrRemoteDialog.setModal(true); |
| | | return localOrRemoteDialog; |
| | | } |
| | | } |
| | | |
| | | /** |