1
2
3
4
5
6 package com.hack23.cia.web.views.components.panels;
7
8 import thinwire.ui.Image;
9 import thinwire.ui.Label;
10 import thinwire.ui.Panel;
11 import thinwire.ui.layout.TableLayout;
12
13 import com.hack23.cia.model.application.dto.common.UserSessionDTO;
14 import com.hack23.cia.model.application.impl.common.Agency;
15 import com.hack23.cia.web.common.ImageConstants;
16
17 /***
18 * The Class ErrorMessagePanel.
19 */
20 public class ErrorMessagePanel extends Panel {
21
22 /*** The error message. */
23 private final Label errorMessage = new Label();
24
25 /*** The user session dto. */
26 private final UserSessionDTO userSessionDTO;
27
28 /***
29 * Instantiates a new error message panel.
30 *
31 * @param userSessionDTO the user session dto
32 * @param message the message
33 */
34 public ErrorMessagePanel(final UserSessionDTO userSessionDTO,final String message) {
35 super();
36 this.userSessionDTO = userSessionDTO;
37 setVisible(false);
38
39 setLayout(new TableLayout(new double[][] { { 0, 0 },
40 { 0 } },
41 2,
42 4));
43
44 final Image errorImage = new Image(ImageConstants.ACTION_ERROR);
45 errorImage.setSize(ImageConstants.ICON_SIZE, ImageConstants.ICON_SIZE);
46 errorImage.setLimit("0,0");
47 getChildren().add(errorImage);
48
49 errorMessage.setLimit("1,0");
50 getChildren().add(errorMessage);
51
52 errorMessage.setText(" "
53 + userSessionDTO
54 .getLanguageResource(Agency.LanguageContentKey.ERROR_MESSAGE) + " : "
55 + message);
56 setVisible(true);
57 }
58 }