org.tentackle.appworx
Class InteractiveError

java.lang.Object
  extended by org.tentackle.appworx.InteractiveError
All Implemented Interfaces:
Serializable

public class InteractiveError
extends Object
implements Serializable

Description of an error.

InteractiveErrors provide a semantic link between the data- and the presentation-layer. Usually, the data is verified at the data-layer and then decorated at the presentation-layer by examining the error (e.g. assign a GUI-component).
The TooltipAndErrorPanel is able to deal with a list of InteractiveErrors.
InteractiveErrors are serializable, so they can be generated at the server and sent to the client. The GUI-component, which can be any object, is transient, however (doesn't make any sense at the server-side anyway).

Author:
harald
See Also:
Serialized Form

Constructor Summary
InteractiveError(int errorCode)
          Creates an error with a unique error code and default Logger.Level.WARNING.
InteractiveError(int errorCode, String text)
          Creates an error with a unique error code.
InteractiveError(int errorCode, String text, Logger.Level level)
          Creates an error with a unique error code.
InteractiveError(String text)
          Creates an error with the default Logger.Level.WARNING and no related component.
InteractiveError(String text, FormComponent component)
          Creates an error with the default Logger.Level.WARNING.
InteractiveError(String text, FormComponent component, Logger.Level level)
          Creates an error.
 
Method Summary
 int getErrorNumber()
          Gets the optional error number.
 FormComponent getFormComponent()
          Gets the related swing GUI-component.
 Object getGuiComponent()
          Gets the related GUI-component.
 Logger.Level getLevel()
          Gets the severity level.
 String getText()
          Gets the error message.
 void setErrorNumber(int errorNumber)
          Sets the optional error number.
 void setFormComponent(FormComponent formComponent)
          Sets the related swing GUI-component.
 void setGuiComponent(Object guiComponent)
          Sets the related GUI-component.
 void setLevel(Logger.Level level)
          Sets the severity level.
 void setText(String text)
          Sets the error message.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InteractiveError

public InteractiveError(String text,
                        FormComponent component,
                        Logger.Level level)
Creates an error.

Parameters:
text - the error text
component - the form component related to the error, null if none
level - the severity (either Logger.Level.WARNING or Logger.Level.SEVERE)

InteractiveError

public InteractiveError(String text,
                        FormComponent component)
Creates an error with the default Logger.Level.WARNING.

Parameters:
text - the error text
component - the form component related to the error

InteractiveError

public InteractiveError(String text)
Creates an error with the default Logger.Level.WARNING and no related component.

Parameters:
text - the error text

InteractiveError

public InteractiveError(int errorCode,
                        String text,
                        Logger.Level level)
Creates an error with a unique error code.

Parameters:
errorCode - the error code
text - the error text
level - the severity (either Logger.Level.WARNING or Logger.Level.SEVERE)

InteractiveError

public InteractiveError(int errorCode,
                        String text)
Creates an error with a unique error code.

Parameters:
errorCode - the error code
text - the error text

InteractiveError

public InteractiveError(int errorCode)
Creates an error with a unique error code and default Logger.Level.WARNING.

Parameters:
errorCode - the error code
Method Detail

toString

public String toString()
Description copied from class: java.lang.Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString in class Object
Returns:
a string representation of the object.

getLevel

public Logger.Level getLevel()
Gets the severity level.

Returns:
one of Logger.Level.WARNING or Logger.Level.SEVERE

setLevel

public void setLevel(Logger.Level level)
Sets the severity level.

Parameters:
level - one of Logger.Level.WARNING or Logger.Level.SEVERE

getText

public String getText()
Gets the error message.

Returns:
the error text

setText

public void setText(String text)
Sets the error message.

Parameters:
text - the error text

getErrorNumber

public int getErrorNumber()
Gets the optional error number.

Returns:
the error number

setErrorNumber

public void setErrorNumber(int errorNumber)
Sets the optional error number.

Parameters:
errorNumber - the error number.

getFormComponent

public FormComponent getFormComponent()
Gets the related swing GUI-component.

Returns:
the component, null if none or guiComponent is not a FormComponent.

setFormComponent

public void setFormComponent(FormComponent formComponent)
Sets the related swing GUI-component.

Parameters:
formComponent - the swing component, null if none

getGuiComponent

public Object getGuiComponent()
Gets the related GUI-component. Can be anything, depending on the presentation layer.

Returns:
the component, null if none

setGuiComponent

public void setGuiComponent(Object guiComponent)
Sets the related GUI-component. Can be anything, depending on the presentation layer.

Parameters:
guiComponent - the component, null if none


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de