-5

I have the following problem. I use XDEV Rapidclipse. I would like to issue a notification.show if an exception flies.

Example

     EntitiyDAO dao = new EntitiyDAO();
     dao.remove(table.getSelectedItem().getBean());

I would like to call, but this is an exception. I would like to now show in the program a error message, whenever this exception flies

Thanks

Auhuur
  • 11
  • 2

2 Answers2

1

There is some existing functionality you can use, for example show your message with a "Notification":

    try {
        // code
    }
    catch (final Exception e) {
        Notification.show("My error message", Type.ERROR_MESSAGE);
    }

For messages with a bigger content you can use a modal "Window". Rapidclipse provides for both a code template.

UIs created with Rapidclipse rely on Vaadin and use GWT widgets, which are HTML. Maybe it is better not to mix UI technologies..

Jo Mei
  • 11
  • 2
0

You should use the Notification of Vaadin.

See here for Vaadin Docs

Short Summary:

Notification.show("This is the caption",
              "This is the description",
              Notification.Type.HUMANIZED_MESSAGE);

In your Case it could be like:

 try
{
 EntitiyDAO dao = new EntitiyDAO();
 dao.remove(table.getSelectedItem().getBean());
}
catch(Exception e)
{
 Notification.show("Something went wrong",
                  e.getMessage(),
                  Notification.Type.ERROR_MESSAGE);
}
PinqPonq
  • 44
  • 1
  • 7