From e7b48693fa292342a04dcaf1fe1c0caf2e7e58ee Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 28 Jan 2009 13:15:02 +0000
Subject: [PATCH] Add a warning type of message pane. It uses the warning icon and a formatted background.
---
opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java | 25 ++++++++++++
opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java | 39 ++++++++++++++++++-
2 files changed, 61 insertions(+), 3 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
index 6923333..5b730b2 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
@@ -1084,6 +1084,20 @@
}
/**
+ * Updates the contents of an editor pane using the warning format.
+ * @param pane the editor pane to be updated.
+ * @param title the title.
+ * @param titleFont the font to be used for the title.
+ * @param details the details message.
+ * @param detailsFont the font to be used for the details.
+ */
+ protected void updateWarningPane(JEditorPane pane, Message title,
+ Font titleFont, Message details, Font detailsFont)
+ {
+ updatePane(pane, title, titleFont, details, detailsFont, PanelType.WARNING);
+ }
+
+ /**
* Updates the contents of an editor pane using the confirmation format.
* @param pane the editor pane to be updated.
* @param title the title.
@@ -1099,12 +1113,27 @@
}
/**
- * The different types of panel that are handled.
+ * The different types of error panels that are handled.
*
*/
- private enum PanelType
+ protected enum PanelType
{
- ERROR, CONFIRMATION, INFORMATION
+ /**
+ * The message in the panel is an error.
+ */
+ ERROR,
+ /**
+ * The message in the panel is a confirmation.
+ */
+ CONFIRMATION,
+ /**
+ * The message in the panel is an information message.
+ */
+ INFORMATION,
+ /**
+ * The message in the panel is a warning message.
+ */
+ WARNING
};
/**
@@ -1130,6 +1159,10 @@
text = Utilities.getFormattedConfirmation(title, titleFont, details,
detailsFont);
break;
+ case WARNING:
+ text = Utilities.getFormattedWarning(title, titleFont, details,
+ detailsFont);
+ break;
default:
text = Utilities.getFormattedSuccess(title, titleFont, details,
detailsFont);
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java b/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
index b6942fd..fa6af3c 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
@@ -1445,6 +1445,31 @@
return "<form>"+buf.toString()+"</form>";
}
+
+ /**
+ * Returns the HTML representation of a warning for a given text.
+ * @param title the title.
+ * @param titleFont the font for the title.
+ * @param details the details.
+ * @param detailsFont the font to be used for the details.
+ * @return the HTML representation of a success for the given text.
+ */
+ public static String getFormattedWarning(Message title, Font titleFont,
+ Message details, Font detailsFont)
+ {
+ StringBuilder buf = new StringBuilder();
+ String space = " ";
+ buf.append(UIFactory.getIconHtml(UIFactory.IconType.WARNING_LARGE) +
+ space + space + applyFont(title.toString(), titleFont));
+ if (details != null)
+ {
+ buf.append("<br><br>")
+ .append(applyFont(details.toString(), detailsFont));
+ }
+ return "<form>"+UIFactory.applyErrorBackgroundToHtml(buf.toString())+
+ "</form>";
+ }
+
/**
* Sets the not available text to a label and associates a help icon and
* a tooltip explaining that the data is not available because the server is
--
Gitblit v1.10.0