

Classes | |
| interface | MessageWidgetListener |
Public Types | |
| enum | MessageType { Error = ("dialog-error.png"), Warning = ("dialog-warning.png"), Info = ("dialog-information.png") } |
Public Member Functions | |
| MessageWidget () | |
| boolean | showMessage (final MessageType messageType, final String shortDescription, final String description) |
| boolean | showMessage (String shortDescription, Throwable t) |
| void | removeMessage () |
| JButton | getAckButton () |
| void | addAckListener (MessageWidgetListener listener) |
| boolean | removeAckListener (MessageWidgetListener listener) |
Private Member Functions | |
| void | initialize () |
| void | notifyListeners () |
Private Attributes | |
| final JLabel | shortDescriptionLbl = new JLabel() |
| final JTextArea | detailedDescritpionTA = new JTextArea() |
| JScrollPane | detailedDescPnl |
| final JLabel | iconLbl = new JLabel() |
| final JLabel | titleLbl = new JLabel() |
| final JButton | ackBtn = new JButton("Ok") |
| Collection< MessageWidgetListener > | ackListeners = null |
The widget reporting messages.
This widget is invisible and appears only when a message must be notified to the user. When the user presses the Ok button, the panel hides itself. The method removeError() allows to hide the panel programmatically.
The look of the panel changes if a detailed description of the error is present. If it is the case, the panel shows a title label on top. If instead the detailed description is not defined, then the label and the detailed panel are hidden. This allows to use the component as "light" or "heavy" by setting a detailed description. Which of the two modality is in use is returned by the boolean of the two showMessage(...) methods.
| com::cosylab::logging::MessageWidget::MessageWidget | ( | ) | [inline] |
| void com::cosylab::logging::MessageWidget::addAckListener | ( | MessageWidgetListener | listener | ) | [inline] |
Add a listener to be notified when the user presses the ack button.
| listener | The listener to add to the list of listeners; the listener is not added if it is already in the list |
References ackListeners.
Referenced by com::cosylab::logging::LoggingClient::initialize().
| JButton com::cosylab::logging::MessageWidget::getAckButton | ( | ) | [inline] |
References ackBtn.
Referenced by com::cosylab::logging::LoggingClient::acsLogConnEstablished(), and com::cosylab::logging::LoggingClient::showErrorMessage().
| void com::cosylab::logging::MessageWidget::initialize | ( | ) | [inline, private] |
Init te GUI.
References ackBtn, detailedDescPnl, detailedDescritpionTA, iconLbl, notifyListeners(), removeMessage(), shortDescriptionLbl, and titleLbl.
Referenced by MessageWidget().
| void com::cosylab::logging::MessageWidget::notifyListeners | ( | ) | [inline, private] |
Notify all the listeners that the user acknowledged the message
References ackListeners.
Referenced by initialize().
| boolean com::cosylab::logging::MessageWidget::removeAckListener | ( | MessageWidgetListener | listener | ) | [inline] |
Remove a listener from the listeners to be notified when the user acknowledges the message. If the listener is not in the list, does nothing.
| listener | The listener to remove from the list of listeners; |
true if an element was removed as a result of this call References ackListeners.
| void com::cosylab::logging::MessageWidget::removeMessage | ( | ) | [inline] |
Hide the error panel.
This happens when the user presses the OK button but it might happen when the abnormal situation has been fixed and therefore jlog has no reason to ask for the attention of the user. One example could be that of an automatic reconnection.
Referenced by initialize().
| boolean com::cosylab::logging::MessageWidget::showMessage | ( | String | shortDescription, | |
| Throwable | t | |||
| ) | [inline] |
Show the glass pane and catches all the events until the user acknowledges the message by pressing the button.
This method shows an error message, by setting the stack trace of the passed Throwable in the detailed description of the error. The throwable and the short description are mandatory to present to the user the message.
| shortDescription | A short description of the message | |
| t | The not null throwable to be displayed in the detailed text area. |
true if the detailed description is not empty i.e. the description scroll panel is visible References showMessage().
| boolean com::cosylab::logging::MessageWidget::showMessage | ( | final MessageType | messageType, | |
| final String | shortDescription, | |||
| final String | description | |||
| ) | [inline] |
Show the glass pane and catches all the events until the user acknowledges the message by pressing the button.
The message type and the short description are mandatory to present to the user the message. A detailed description can also be given to better explain what's going on. It might be a stack trace, for example.
| messageType | The type of the message | |
| shortDescription | A short description of the message | |
| description | The detailed description; it can be null or empty. |
true if the detailed description is not empty i.e. the description scroll panel is visible References detailedDescPnl, detailedDescritpionTA, iconLbl, shortDescriptionLbl, and titleLbl.
Referenced by com::cosylab::logging::LoggingClient::showErrorMessage(), and showMessage().
final JButton com::cosylab::logging::MessageWidget::ackBtn = new JButton("Ok") [private] |
The button to acknowledge the message
Referenced by getAckButton(), and initialize().
Collection<MessageWidgetListener> com::cosylab::logging::MessageWidget::ackListeners = null [private] |
The listeners to be notified when the user acknowledges the message
Referenced by addAckListener(), notifyListeners(), and removeAckListener().
JScrollPane com::cosylab::logging::MessageWidget::detailedDescPnl [private] |
The panel with the detailed description of the problem.
This component appears only if it is not empty.
Referenced by initialize(), and showMessage().
final JTextArea com::cosylab::logging::MessageWidget::detailedDescritpionTA = new JTextArea() [private] |
The text to give a detailed description of the problem.
Referenced by initialize(), and showMessage().
final JLabel com::cosylab::logging::MessageWidget::iconLbl = new JLabel() [private] |
The icon
Referenced by initialize(), and showMessage().
final JLabel com::cosylab::logging::MessageWidget::shortDescriptionLbl = new JLabel() [private] |
The text describing the problem
Referenced by initialize(), and showMessage().
final JLabel com::cosylab::logging::MessageWidget::titleLbl = new JLabel() [private] |
The title of the error.
The title is displayed on top but only if the detailed description is present.
Referenced by initialize(), and showMessage().
1.6.2