com.vaadin.data.


Class Validator.InvalidValueException

java.lang.Object
  java.lang.Throwable
      java.lang.Exception
          java.lang.RuntimeException
              com.vaadin.data.Validator.InvalidValueException

All Implemented Interfaces:

ErrorMessage, Paintable, Serializable, EventListener

Direct Known Subclasses:

DateField.UnparsableDateString, Validator.EmptyValueException

Enclosing interface:

Validator

public static class Validator.InvalidValueException
extends RuntimeException
implements ErrorMessage

Exception that is thrown by a Validator when a value is invalid.

The default implementation of InvalidValueException does not support HTML in error messages. To enable HTML support, override getHtmlMessage() and use the subclass in validators.

Since:

3.0

Version:

6.8.18

Author:

Vaadin Ltd.

See Also:

Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Field Summary
 
Fields inherited from interface com.vaadin.terminal.ErrorMessage
CRITICAL, ERROR, INFORMATION, SYSTEMERROR, WARNING
 
Constructor Summary
Validator.InvalidValueException(String message)
          Constructs a new InvalidValueException with the specified message.
Validator.InvalidValueException(String message, Validator.InvalidValueException[] causes)
          Constructs a new InvalidValueException with a set of causing validation exceptions.
 
Method Summary
 void addListener(Paintable.RepaintRequestListener listener)
          Error messages are inmodifiable and thus listeners are not needed.
 Validator.InvalidValueException[] getCauses()
          Returns the InvalidValueExceptions that caused this exception.
 String getDebugId()
          Get's currently set debug identifier
 int getErrorLevel()
          Gets the errors level.
protected  String getHtmlMessage()
          Returns the message of the error in HTML.
 boolean isInvisible()
          Check if the error message should be hidden.
 void paint(PaintTarget target)
           Paints the Paintable into a UIDL stream.
 void removeListener(Paintable.RepaintRequestListener listener)
          Error messages are inmodifiable and thus listeners are not needed.
 void requestRepaint()
          Error messages are inmodifiable and thus listeners are not needed.
 void requestRepaintRequests()
          Request sending of repaint events on any further visible changes.
 void setDebugId(String id)
          Adds an unique id for component that get's transferred to terminal for testing purposes.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Validator.InvalidValueException

public Validator.InvalidValueException(String message)

Constructs a new InvalidValueException with the specified message.

Parameters:
message - The detail message of the problem.

Validator.InvalidValueException

public Validator.InvalidValueException(String message,
                                       Validator.InvalidValueException[] causes)

Constructs a new InvalidValueException with a set of causing validation exceptions. The causing validation exceptions are included when the exception is painted to the client.

Parameters:
message - The detail message of the problem.
causes - One or more InvalidValueExceptions that caused this exception.

Method Detail

isInvisible

public boolean isInvisible()

Check if the error message should be hidden. An empty (null or "") message is invisible unless it contains nested exceptions that are visible.

Returns:
true if the error message should be hidden, false otherwise

getErrorLevel

public final int getErrorLevel()

Description copied from interface: ErrorMessage

Gets the errors level.

Specified by:
getErrorLevel in interface ErrorMessage

Returns:
the level of error as an integer.

paint

public void paint(PaintTarget target)
           throws PaintException

Description copied from interface: Paintable

Paints the Paintable into a UIDL stream. This method creates the UIDL sequence describing it and outputs it to the given UIDL stream.

It is called when the contents of the component should be painted in response to the component first being shown or having been altered so that its visual representation is changed.

Specified by:
paint in interface Paintable

Parameters:
target - the target UIDL stream where the component should paint itself to.
Throws:
PaintException - if the paint operation failed.

getHtmlMessage

protected String getHtmlMessage()

Returns the message of the error in HTML. Note that this API may change in future versions.

addListener

public void addListener(Paintable.RepaintRequestListener listener)

Description copied from interface: ErrorMessage

Error messages are inmodifiable and thus listeners are not needed. This method should be implemented as empty.

Specified by:
addListener in interface ErrorMessage
Specified by:
addListener in interface Paintable

Parameters:
listener - the listener to be added.
See Also:
Paintable.addListener(Paintable.RepaintRequestListener)

removeListener

public void removeListener(Paintable.RepaintRequestListener listener)

Description copied from interface: ErrorMessage

Error messages are inmodifiable and thus listeners are not needed. This method should be implemented as empty.

Specified by:
removeListener in interface ErrorMessage
Specified by:
removeListener in interface Paintable

Parameters:
listener - the listener to be removed.
See Also:
Paintable.removeListener(Paintable.RepaintRequestListener)

requestRepaint

public void requestRepaint()

Description copied from interface: ErrorMessage

Error messages are inmodifiable and thus listeners are not needed. This method should be implemented as empty.

Specified by:
requestRepaint in interface ErrorMessage
Specified by:
requestRepaint in interface Paintable

See Also:
Paintable.requestRepaint()

requestRepaintRequests

public void requestRepaintRequests()

Description copied from interface: Paintable

Request sending of repaint events on any further visible changes. Normally the paintable only send up to one repaint request for listeners after paint as the paintable as the paintable assumes that the listeners already know about the repaint need. This method resets the assumtion. Paint implicitly does the assumtion reset functionality implemented by this method.

This method is normally used only by the terminals to note paintables about implicit repaints (painting the component without actually invoking paint method).

Specified by:
requestRepaintRequests in interface Paintable

getDebugId

public String getDebugId()

Description copied from interface: Paintable

Get's currently set debug identifier

Specified by:
getDebugId in interface Paintable

Returns:
current debug id, null if not set

setDebugId

public void setDebugId(String id)

Description copied from interface: Paintable

Adds an unique id for component that get's transferred to terminal for testing purposes. Keeping identifiers unique throughout the Application instance is on programmers responsibility.

Note, that with the current terminal implementation the identifier cannot be changed while the component is visible. This means that the identifier should be set before the component is painted for the first time and kept the same while visible in the client.

Specified by:
setDebugId in interface Paintable

Parameters:
id - A short (< 20 chars) alphanumeric id

getCauses

public Validator.InvalidValueException[] getCauses()

Returns the InvalidValueExceptions that caused this exception.

Returns:
An array containing the InvalidValueExceptions that caused this exception. Returns an empty array if this exception was not caused by other exceptions.