summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-07-03 08:36:40 (EDT)
committerCarsten Drossel2008-07-03 08:36:40 (EDT)
commite59cdbf5592d614ebd85de17514a7cbee1a7ef4a (patch)
treeac846b754244fcf81a8e1bdf3828706f38ee7ff4
parentd0975435f5f1c8e14f02586191c431792d501357 (diff)
downloadorg.eclipse.riena-e59cdbf5592d614ebd85de17514a7cbee1a7ef4a.zip
org.eclipse.riena-e59cdbf5592d614ebd85de17514a7cbee1a7ef4a.tar.gz
org.eclipse.riena-e59cdbf5592d614ebd85de17514a7cbee1a7ef4a.tar.bz2
added MessageBoxRidget
-rw-r--r--org.eclipse.riena.ui.ridgets/src/org/eclipse/riena/ui/ridgets/IMessageBoxRidget.java199
1 files changed, 199 insertions, 0 deletions
diff --git a/org.eclipse.riena.ui.ridgets/src/org/eclipse/riena/ui/ridgets/IMessageBoxRidget.java b/org.eclipse.riena.ui.ridgets/src/org/eclipse/riena/ui/ridgets/IMessageBoxRidget.java
new file mode 100644
index 0000000..aa2bfee
--- /dev/null
+++ b/org.eclipse.riena.ui.ridgets/src/org/eclipse/riena/ui/ridgets/IMessageBoxRidget.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.ui.ridgets;
+
+/**
+ * Shows messages to the user in a popup window with a selection of buttons that
+ * also allows to ask simple questions of the "yes/no"- or the "ok/cancel"-type.
+ */
+public interface IMessageBoxRidget extends IRidget {
+
+ /**
+ * The type of the message box.
+ */
+ enum Type {
+ /**
+ * Information message.
+ */
+ INFORMATION,
+ /**
+ * Warning message.
+ */
+ WARNING,
+ /**
+ * Error message.
+ */
+ ERROR,
+ /**
+ * Help message.
+ */
+ HELP,
+ /**
+ * Message popup to ask a question.
+ */
+ QUESTION,
+ /**
+ * None of the other types. No icon is shown.
+ */
+ PLAIN
+ }
+
+ /**
+ * The 'OK' button.
+ */
+ MessageBoxOption OK = new MessageBoxOption();
+
+ /**
+ * The 'Cancel' button.
+ */
+ MessageBoxOption CANCEL = new MessageBoxOption();
+
+ /**
+ * The 'Yes' button.
+ */
+ MessageBoxOption YES = new MessageBoxOption();
+
+ /**
+ * The 'No' button.
+ */
+ MessageBoxOption NO = new MessageBoxOption();
+
+ /**
+ * An option that stands for the popup window being closed without pressing
+ * one of the button.
+ */
+ MessageBoxOption CLOSED = new MessageBoxOption();
+
+ /**
+ * A predefined combination of options with just an 'OK' button.
+ */
+ MessageBoxOption[] OPTIONS_OK = new MessageBoxOption[] { OK };
+
+ /**
+ * A predefined combination of options with 'OK' and 'Cancel'.
+ */
+ MessageBoxOption[] OPTIONS_OK_CANCEL = new MessageBoxOption[] { OK, CANCEL };
+
+ /**
+ * A predefined combination of options with 'Yes' and 'No'.
+ */
+ MessageBoxOption[] OPTIONS_YES_NO = new MessageBoxOption[] { YES, NO };
+
+ /**
+ * A predefined combination of options with 'Yes', 'No' and 'Cancel'.
+ */
+ MessageBoxOption[] OPTIONS_YES_NO_CANCEL = new MessageBoxOption[] { YES, NO, CANCEL };
+
+ /**
+ * Returns the title of the message box.
+ *
+ * @return The message title.
+ */
+ String getTitle();
+
+ /**
+ * Sets the title of the message box.
+ *
+ * @param title
+ * The message title.
+ */
+ void setTitle(String title);
+
+ /**
+ * Returns the text that is displayed inside the message box.
+ *
+ * @return The message text.
+ */
+ String getText();
+
+ /**
+ * Sets the text that is displayed inside the message box.
+ *
+ * @param text
+ * The message text.
+ */
+ void setText(String text);
+
+ /**
+ * Returns the type of the message.
+ *
+ * @return The message type.
+ * @see Type
+ */
+ Type getType();
+
+ /**
+ * Set the type of message.
+ *
+ * @param type
+ * The message type.
+ * @see Type
+ */
+ void setType(Type type);
+
+ /**
+ * Return the options displayed as buttons in the popup window.
+ *
+ * @return The message options.
+ */
+ MessageBoxOption[] getOptions();
+
+ /**
+ * Sets the options displayed as buttons in the popup window. Can be either
+ * a predefined combination or any combination of standard buttons and
+ * custom buttons.
+ *
+ * @see #OPTIONS_OK
+ * @see #OPTIONS_OK_CANCEL
+ * @see #OPTIONS_YES_NO
+ * @see #OPTIONS_YES_NO_CANCEL
+ * @see MessageBoxOption#MessageBoxOption(String)
+ * @param options
+ * The message options.
+ */
+ void setOptions(MessageBoxOption[] options);
+
+ /**
+ * Shows the message box.
+ *
+ * @return The selected option.
+ * @see MessageBoxOption
+ */
+ MessageBoxOption show();
+
+ /**
+ * An option shown as a button in the popup dialog.
+ */
+ class MessageBoxOption {
+
+ private String label;
+
+ private MessageBoxOption() {
+ // a default option with a label depending on the UI widget
+ }
+
+ /**
+ * Creates a custom option.
+ *
+ * @param label
+ * The button label.
+ */
+ public MessageBoxOption(String label) {
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ }
+
+}