sk.uniba.euromath.editor.widgets
Class ValidityMessages

java.lang.Object
  extended by sk.uniba.euromath.editor.widgets.ValidityMessages

public final class ValidityMessages
extends Object

Describes correctness of data in a widget.

Author:
Martin Vysny

Field Summary
 String error
          Error message.
 String info
          Info message.
 String warning
          Warning message.
 
Constructor Summary
ValidityMessages()
          Constructor, sets all three strings to null.
ValidityMessages(String error)
          Constructor, sets error message.
ValidityMessages(ValidityMessages other)
          Clones given object.
 
Method Summary
 boolean equalsTopLevelMsg(ValidityMessages other)
          Checks if two validity messages equals, in terms of changing the displayed text.
static boolean equalsTopLevelMsg(ValidityMessages msg1, ValidityMessages msg2)
          Checks if two validity messages equals, in terms of changing the displayed text.
 MessageLevelEnum getLevel()
          Returns level of messages.
static boolean isError(ValidityMessages messages)
          Checks if given messages contains error.
 void setField(MessageLevelEnum level, String message, boolean overwrite)
          Sets given field.
static ValidityMessages setField(ValidityMessages messages, MessageLevelEnum level, String message, boolean overwrite)
          Sets field to a value and returns instance of messages object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

error

public String error
Error message. If null or empty string then there is no error.


warning

public String warning
Warning message. If null or empty string then there is no warning.


info

public String info
Info message. If null or empty string then there is no info.

Constructor Detail

ValidityMessages

public ValidityMessages()
Constructor, sets all three strings to null. Calls this((String)null).


ValidityMessages

public ValidityMessages(String error)
Constructor, sets error message.

Parameters:
error - the error message to set.

ValidityMessages

public ValidityMessages(ValidityMessages other)
Clones given object.

Parameters:
other - object to clone. If null then all messages will be null.
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getLevel

public MessageLevelEnum getLevel()
Returns level of messages.

Returns:
level of message, or null if the message does not contain error, warning nor information.

equalsTopLevelMsg

public static final boolean equalsTopLevelMsg(ValidityMessages msg1,
                                              ValidityMessages msg2)
Checks if two validity messages equals, in terms of changing the displayed text.

Parameters:
msg1 - first messages object.
msg2 - second messages object.
Returns:
true if setting other over this will not change the displayed message.

equalsTopLevelMsg

public final boolean equalsTopLevelMsg(ValidityMessages other)
Checks if two validity messages equals, in terms of changing the displayed text.

Parameters:
other - the other messages object.
Returns:
true if setting other over this will not change the displayed message.

isError

public static boolean isError(ValidityMessages messages)
Checks if given messages contains error.

Parameters:
messages - messages to check
Returns:
true if it contains non-empty error message

setField

public void setField(MessageLevelEnum level,
                     String message,
                     boolean overwrite)
Sets given field.

Parameters:
level - determines the field.
message - the message.
overwrite - if false and given field is not null then it is not overwritten.

setField

public static ValidityMessages setField(ValidityMessages messages,
                                        MessageLevelEnum level,
                                        String message,
                                        boolean overwrite)
Sets field to a value and returns instance of messages object. Creates new instance of messages object if needed (messages==null && message!=null).

Parameters:
messages - current message object. Overwritten if not null.
level - determines the field
message - the message
overwrite - if false and given field is not null then it is not overwritten.
Returns:
messages object with given message set.


Copyright © 2003-2006 null. All Rights Reserved.