package com.alexrnl.commons.translation;


/**
 * This class is defining the translation for a dialog.<br />
 * A standard dialog is composed of a title and a message, this class factorise the definition of
 * the keys for these data and uses the {@link #toString()} method to build the key.<br />
 * This class also implements the {@link ParametrableTranslation} interface which returns an empty
 * parameter array by default (i.e. no parameter are accepted by this dialog); override the method
 * {@link #getParameters()} if necessary.
 * Example of implementation (with the use of the parameters):
 * <pre>
 * public class HelloDialog extends AbstractDialog {
 * 	private String helloKey;
 * 	private Object[] parameters;
 * 
 * 	public HelloDialog (String name) {
 * 		super();
 * 		this.helloKey = "commons.dialogs.hello";
 * 		this.parameters = new Object[1];
 * 		parameters[0] = name;
 * 	}
 * 
 *	public String toString () {
 *		return helloKey;
 *	}
 *
 *	public Object[] getParameters () {
 *		return parameters;
 *	}
 *	
 * }
 * </pre>
 * @author Alex
 */
public abstract class AbstractDialog implements ParametrableTranslation {
	
	/**
	 * The title of the dialog.
	 * @return the translation of the dialog's title.
	 */
	public String title () {
		return toString() + "." + "title";
	}
	
	/**
	 * The message of the dialog.
	 * @return the translation of the dialog's message.
	 */
	public String message () {
		return toString() + "." + "message";
	}

	/**
	 * Provide the key to the dialog, which allow to define the {@link #title()} and
	 * {@link #message()} method at this level.
	 */
	@Override
	public abstract String toString ();

	/**
	 * By default, all dialogs are parametrable
	 */
	@Override
	public Object[] getParameters () {
		return new Object[0];
	}
}

@@ -594,16 +594,20 @@
 eters):%0A
+ * %0A
  * %3Cpre%3E
@@ -678,17 +678,18 @@
 e String
- 
+%09%09
 helloKey
@@ -710,17 +710,17 @@
 Object%5B%5D
- 
+%09
 paramete
@@ -801,17 +801,22 @@
 loKey = 
-%22
+&quot;
 commons.
@@ -828,17 +828,22 @@
 gs.hello
-%22
+&quot;
 ;%0A * %09%09t
@@ -913,16 +913,17 @@
 %7D%0A * %0A *
+ 
 %09public 
@@ -937,32 +937,33 @@
 toString () %7B%0A *
+ 
 %09%09return helloKe
@@ -971,16 +971,19 @@
 ;%0A *
+ 
 %09%7D%0A *
+ 
 %0A *
+ 
 %09pub
@@ -1016,16 +1016,17 @@
  () %7B%0A *
+ 
 %09%09return
@@ -1044,14 +1044,15 @@
 ;%0A *
+ 
 %09%7D%0A *
-%09
+ 
 %0A * 
@@ -1063,16 +1063,235 @@
  %3C/pre%3E%0A
+ * %0A * When instantiating this class, the translation key for the title will be%0A * %3Ccode%3Ecommons.dialogs.hello.title%3C/code%3E and the translation key for the message will be%0A * %3Ccode%3Ecommons.dialogs.hello.message%3C/code%3E.%0A
  * @auth
@@ -1928,20 +1928,171 @@
 are 
-parametrable
+configurable but return no parameters.%3Cbr /%3E%0A%09 * This allow to define generic behavior for displaying dialogs, override this if the dialog%0A%09 * requires parameters.
 %0A%09 *

Complete documentation of AbstractDialog class