org.knime.core.util.tokenizer
Class SettingsStatus

java.lang.Object
  extended by org.knime.core.util.tokenizer.SettingsStatus

public class SettingsStatus
extends Object

An object to pass messages. It supports information, warning, and error messages.

Author:
Peter Ohl, University of Konstanz

Constructor Summary
SettingsStatus()
          Creates a new status object with no messages.
 
Method Summary
 void addError(String msg)
          Adds an error message to the status object.
 void addInfo(String msg)
          Adds an informational message to the status object.
 void addWarning(String msg)
          Adds a warning message to the status object.
 String getAllErrorMessages(int maxMsg)
          Creates a string containing concatenated error messages, separated by a new line ('\n') character.
 String getErrorMessage(int idx)
           
 String getInfoMessage(int idx)
           
 int getNumOfAllMessages()
           
 int getNumOfErrors()
           
 int getNumOfInfos()
           
 int getNumOfWarnings()
           
 String getWarningMessage(int idx)
           
 void printErrors()
          Prints all error messages into the logger as error.
 void printInfos()
          Prints all info messages into the logger as info.
 void printWarnings()
          Prints all warning messages into the logger as warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SettingsStatus

public SettingsStatus()
Creates a new status object with no messages.

Method Detail

addInfo

public void addInfo(String msg)
Adds an informational message to the status object.

Parameters:
msg - the info message to add

getNumOfInfos

public int getNumOfInfos()
Returns:
the number of informational messages stored

getInfoMessage

public String getInfoMessage(int idx)
Parameters:
idx - the index of the info message to return (must be 0...NumOfInfos-1)
Returns:
the idx-th informational message

addWarning

public void addWarning(String msg)
Adds a warning message to the status object.

Parameters:
msg - the warning message to add

getNumOfWarnings

public int getNumOfWarnings()
Returns:
the number of warning messages stored.

getWarningMessage

public String getWarningMessage(int idx)
Parameters:
idx - the index of the warning message to return (must be 0...NumOfWarnings-1)
Returns:
the idx-th warning message

addError

public void addError(String msg)
Adds an error message to the status object.

Parameters:
msg - the error message to add

getNumOfErrors

public int getNumOfErrors()
Returns:
the number of error messages stored

getErrorMessage

public String getErrorMessage(int idx)
Parameters:
idx - the index of the error message to return (must be 0...NumOfErors-1)
Returns:
the idx-th error message

getNumOfAllMessages

public int getNumOfAllMessages()
Returns:
the number of all messages, i.e. number of errors plus infos plus warnings.

printErrors

public void printErrors()
Prints all error messages into the logger as error. It will print "Error: ", the error message and a new line character.


printWarnings

public void printWarnings()
Prints all warning messages into the logger as warning. It will print "Warning: ", the message and a new line character.


printInfos

public void printInfos()
Prints all info messages into the logger as info. It will print "Info: ", the message and a new line character.


getAllErrorMessages

public String getAllErrorMessages(int maxMsg)
Creates a string containing concatenated error messages, separated by a new line ('\n') character. The maximum number of error messages included is determined by the parameter maxMsg. If more error than maxMsg messages are stored in the status object, the subset of messages included in the string is determined by the order the messages were added to the status object. The first maxMsg messages will be used. Result could be an empty string, never null.

Parameters:
maxMsg - the max number of error messages to include in the result. If set to a number less than or equal 0 all error messages are included.
Returns:
a String containing the first maxMsg error messages. Result will be an empty string if status contains no error messages.


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.