com.levigo.util.swing.infobar
Class SimpleMessage

java.lang.Object
  extended by com.levigo.util.swing.infobar.SimpleMessage
All Implemented Interfaces:
MessageConsumer.Message

public class SimpleMessage
extends Object
implements MessageConsumer.Message

A simple implementation of MessageConsumer.Message which is used in situations where the message shall be generated directly.


Constructor Summary
SimpleMessage(String message, Level level)
           
 
Method Summary
 JComponent createDetailsView()
          Create a visual representation of the message.
 Icon getIcon()
          Get the icon (if any) to be associated with the message.
 String getID()
          Get the message's ID.
 Level getLevel()
           
 String getMessage()
          Get the - usually one-line - message to be shown initially.
 int getPriority()
          Get the message priority.
 Throwable getThrowable()
           
 String getType()
          Get the message type.
 boolean hasDetails()
          Return whether the message has associated details.
 void setID(String id)
           
 void setLevel(Level level)
           
 void setMessage(String message)
           
 void setThrowable(Throwable throwable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMessage

public SimpleMessage(String message,
                     Level level)
Method Detail

getIcon

public Icon getIcon()
Description copied from interface: MessageConsumer.Message
Get the icon (if any) to be associated with the message.

Specified by:
getIcon in interface MessageConsumer.Message
Returns:

getMessage

public String getMessage()
Description copied from interface: MessageConsumer.Message
Get the - usually one-line - message to be shown initially.

Specified by:
getMessage in interface MessageConsumer.Message
Returns:

createDetailsView

public JComponent createDetailsView()
Description copied from interface: MessageConsumer.Message
Create a visual representation of the message. It is up to the message to create any visual representation it sees fit. However, it is up to the caller of this method to provide a vessel for presentation to the user. Therefore the representation must refrain from adding unnecessary borders, UI elements for the disposal of the containing frame etc.

Specified by:
createDetailsView in interface MessageConsumer.Message
Returns:

hasDetails

public boolean hasDetails()
Description copied from interface: MessageConsumer.Message
Return whether the message has associated details. This method should return quickly. If this method returns true for a message, the message is obliged to create a visual representation for the message upon MessageConsumer.Message.createDetailsView().

Specified by:
hasDetails in interface MessageConsumer.Message
Returns:

getPriority

public int getPriority()
Description copied from interface: MessageConsumer.Message
Get the message priority. Using message priorities allows consumers to prioritize messages with respect to their importance and thus control their presentation to a user. The absolute value of a priority must not be used by a consumer, only relative priorities shall be taken into consideration. Nevertheless, if a consumer is fed by multiple message sources, those sources must agree upon their relative priorities. Higher priority values indicate higher message importance.

Specified by:
getPriority in interface MessageConsumer.Message
Returns:

getType

public String getType()
Description copied from interface: MessageConsumer.Message
Get the message type. This information may be presented to users by some consumers.

Specified by:
getType in interface MessageConsumer.Message
Returns:

getID

public String getID()
Description copied from interface: MessageConsumer.Message
Get the message's ID. The ID may be used to group similar messages even if the actual messages (as in MessageConsumer.Message.getMessage()) vary slightly. If a message doesn't have an ID, it is ok to return null or the same string as MessageConsumer.Message.getMessage().

Specified by:
getID in interface MessageConsumer.Message
Returns:

setID

public void setID(String id)

getLevel

public Level getLevel()

setLevel

public void setLevel(Level level)

getThrowable

public Throwable getThrowable()

setThrowable

public void setThrowable(Throwable throwable)

setMessage

public void setMessage(String message)


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.