|
23 | 23 |
|
24 | 24 | import com.vaadin.flow.component.Component;
|
25 | 25 | import com.vaadin.flow.component.Html;
|
| 26 | +import com.vaadin.flow.component.Text; |
26 | 27 | import com.vaadin.flow.component.UI;
|
27 | 28 | import com.vaadin.flow.component.button.Button;
|
28 | 29 | import com.vaadin.flow.component.button.ButtonVariant;
|
29 | 30 | import com.vaadin.flow.component.dependency.CssImport;
|
30 | 31 | import com.vaadin.flow.component.dialog.Dialog;
|
31 | 32 | import com.vaadin.flow.component.html.Div;
|
| 33 | +import com.vaadin.flow.component.html.Span; |
32 | 34 | import com.vaadin.flow.component.icon.VaadinIcon;
|
33 | 35 | import com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment;
|
34 | 36 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
@@ -216,7 +218,7 @@ private VerticalLayout createMainLayout() {
|
216 | 218 | title.getElement().getStyle().set("width", "100%");
|
217 | 219 | mainLayout.add(title);
|
218 | 220 |
|
219 |
| - final Html errorLabel = createErrorLabel(); |
| 221 | + Component errorLabel = createErrorLabel(); |
220 | 222 | mainLayout.add(errorLabel);
|
221 | 223 | mainLayout.setHorizontalComponentAlignment(Alignment.START, errorLabel);
|
222 | 224 |
|
@@ -300,18 +302,21 @@ private String getStackTrace() {
|
300 | 302 | pw.flush();
|
301 | 303 | return baos.toString();
|
302 | 304 | }
|
303 |
| - |
304 |
| - protected Html createErrorLabel() { |
305 |
| - String label = errorMessage == null ? i18n.getDefaultErrorMessage() : errorMessage; |
| 305 | + |
| 306 | + protected Component createErrorLabel() { |
| 307 | + Div errorLabel = new Div(); |
| 308 | + errorLabel.setClassName("errorlabel"); |
| 309 | + |
306 | 310 | if (productionMode) {
|
307 |
| - label = |
308 |
| - label.concat( |
309 |
| - String.format( |
310 |
| - "<br />%s<br /><span class='uuid'>%s</span>", |
311 |
| - i18n.getInstructions(), uuid)); |
| 311 | + Div instructions = new Div(new Text(i18n.getInstructions())); |
| 312 | + Span uuidSpan = new Span(uuid); |
| 313 | + uuidSpan.setClassName("uuid"); |
| 314 | + errorLabel.add(instructions, uuidSpan); |
| 315 | + } else { |
| 316 | + String label = errorMessage == null ? i18n.getDefaultErrorMessage() : errorMessage; |
| 317 | + errorLabel.setText(label); |
312 | 318 | }
|
313 |
| - final Html errorLabel = new Html("<span>" + label + "</span>"); |
314 |
| - errorLabel.getElement().getClassList().add("errorlabel"); |
| 319 | + |
315 | 320 | return errorLabel;
|
316 | 321 | }
|
317 | 322 | }
|
0 commit comments