this.getLogger().trace("EXIT!"); //NOI18N
}
- /**
- * Displays a textual address "box" of given contact
- *
- * @param contact Contact to show address for
- */
@Override
public void displayAddressBox (final Contact contact) {
// Trace message
this.getLogger().trace("EXIT!"); //NOI18N
}
- /**
- * Displays a textual name "box" of given contact
- *
- * @param contact Contact to show name for
- */
@Override
public void displayNameBox (final Contact contact) {
// Trace message
this.getLogger().trace("EXIT!"); //NOI18N
}
- /**
- * Displays a textual other data "box" of given contact
- *
- * @param contact Contact to show other data for
- */
@Override
public void displayOtherDataBox (final Contact contact) {
// Trace message
return contact;
}
- /**
- * Shutdown this client
- */
@Override
public void doShutdown () throws SQLException, IOException {
// Trace message
super.doShutdown();
// TODO Add other shutdown stuff
-
// Trace message
this.getLogger().trace("EXIT!"); //NOI18N
}
manager.doDeleteOtherAddress();
break;
- case '0':
- try {
- // Program exit
- this.getApplication().doShutdown();
- } catch (final SQLException | IOException ex) {
- this.abortProgramWithException(ex);
- }
- break;
+ case '0':
+ try {
+ // Program exit
+ this.getApplication().doShutdown();
+ } catch (final SQLException | IOException ex) {
+ this.abortProgramWithException(ex);
+ }
+ break;
default:
// TODO throw own exception
this.getLogger().trace("EXIT!"); //NOI18N
}
- /**
- * Asks the the user to enter a single character which must match validChars
- *
- * @param validChars Valid chars that are accepted
- * @param message Message to user
- * @return Allowed character
- */
@Override
public char enterChar (final char[] validChars, final String message) {
// Trace message
return input;
}
- /**
- * Asks the user to enter his/her gender
- *
- * @param message Message to the user
- * @return Gender enum
- */
@Override
public Gender enterGender (final String message) {
// Trace message
Gender g = Gender.fromChar(gender);
// g must not be null
- assert(g instanceof Gender) : "g is not set."; //NOI18N
+ assert (g instanceof Gender) : "g is not set."; //NOI18N
// Trace message
this.getLogger().trace(MessageFormat.format("g={0} - EXIT!", g)); //NOI18N
return g;
}
- /**
- * Reads an integer (int) with a textural message from the user
- *
- * @param minimum Minimum allowed number
- * @param maximum Maximum allowed number
- * @param message Messager to display in console
- * @return
- */
@Override
public int enterInt (final int minimum, final int maximum, final String message) {
// Trace message
this.getLogger().trace(MessageFormat.format("minimum={0},maximum={1},message={2} - CALLED!", minimum, maximum, message)); //NOI18N
// Minimum should not be below zero
- assert (minimum >= 0);
- assert (maximum > minimum);
+ assert (minimum >= 0) : MessageFormat.format("minimum={0} is below zero", minimum); //NOI18N
+ assert (maximum > minimum) : MessageFormat.format("maximum {0} is smaller than minimum {1}", maximum, minimum); //NOI18N
// Init input
int input = -1;
return input;
}
- /**
- * Reads a string of minimum and maximum length from the user
- *
- * @param minLength Minimum length of the string to read
- * @param maxLength Maximum length of the string to read
- * @param message Message to user
- * @param allowEmpty Whether to allow empty string
- * @return Entered string by user or null for empty strings
- */
@Override
public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) {
// Trace message
return input;
}
- /**
- * Returns a console menu item
- *
- * @param accessKey Key to access the menu
- * @param text Text to show to user
- * @return A SelectableMenuItem
- * TODO Make sure the access key is unique
- */
@Override
public SelectableMenuItem getMenuItem (final char accessKey, final String text) {
// Return a new console menu item
return new ConsoleMenuItem(accessKey, text);
}
- /**
- * Initializes this client
- */
@Override
public void init () {
// Trace message
this.getLogger().trace("EXIT!"); //NOI18N
}
- /**
- * Displays textural message to the user
- *
- * @param message
- */
@Override
public void outputMessage (final String message) {
System.out.println(message);
}
- /**
- * Shows textural menu on console
- */
@Override
public void showCurrentMenu () {
this.showMenu(this.getCurrentMenu());
}
- /**
- * Shows given menu entry to user
- *
- * @param item Menu entry
- */
@Override
public void showEntry (final SelectableMenuItem item) {
// Access key then text
- this.outputMessage(MessageFormat.format("[{0}] {1}", item.getAccessKey(), item.getText()));
+ this.outputMessage(MessageFormat.format("[{0}] {1}", item.getAccessKey(), item.getText())); //NOI18N
}
- /**
- * Shows a textural message to the user
- */
@Override
public void showWelcome () {
- this.outputMessage(MessageFormat.format("Welcome to {0}", AddressbookApplication.printableTitle()));
- this.outputMessage("");
- this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");
+ this.outputMessage(MessageFormat.format("Welcome to {0}", AddressbookApplication.printableTitle())); //NOI18N
+ this.outputMessage(""); //NOI18N
+ this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software"); //NOI18N
// Debug message
this.getLogger().debug("Intro shown to user"); //NOI18N
return this.scanner.nextLine();
}
- /**
- * Fills menu map with menu entries
- */
@Override
protected final void fillMenuMap () {
// Trace message