Skip to content

Commit

Permalink
0004943: Various visual tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-miller-jumpmind committed Aug 20, 2021
1 parent 34001f9 commit 39f2628
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
Expand Up @@ -147,14 +147,16 @@ public static void notify(String caption, String message, Throwable ex, Notifica
Page page = UI.getCurrent().getPage();
if (page != null) {
HorizontalLayout layout = new HorizontalLayout();
layout.setWidth("400px");
Notification notification = new Notification(layout);

Label label = new Label(caption + "\n" + contactWithLineFeed(FormatUtils.wordWrap(message, 150)));
layout.add(label);
layout.setVerticalComponentAlignment(Alignment.CENTER, label);

Icon closeIcon = new Icon(VaadinIcon.CLOSE_CIRCLE_O);
closeIcon.setSize("8ex");
closeIcon.setSize("36px");
closeIcon.getStyle().set("min-width", "36px");
closeIcon.addClickListener(event -> notification.close());
closeIcon.addClickShortcut(Key.ESCAPE);
layout.add(closeIcon);
Expand Down
Expand Up @@ -25,10 +25,9 @@
import org.apache.commons.lang3.exception.ExceptionUtils;

import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.Scroller;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.notification.NotificationVariant;
import com.vaadin.flow.component.UI;

public class NotifyDialog extends ResizableDialog {

Expand All @@ -43,24 +42,23 @@ public NotifyDialog(String text, Throwable ex) {
public NotifyDialog(String caption, String text, final Throwable ex, NotificationVariant type) {
super(caption);
setWidth("400px");
setHeight("300px");
setHeight("320px");

content.setHeight("86%");

final HorizontalLayout messageArea = new HorizontalLayout();
messageArea.addClassName("v-scrollable");
messageArea.setMargin(true);
messageArea.setSpacing(true);
final Scroller messageArea = new Scroller();
messageArea.setSizeFull();

text = isNotBlank(text) ? text : (ex != null ? ex.getMessage()
: "");
if (type == NotificationVariant.LUMO_ERROR) {
//setIcon(VaadinIcon.BAN);
captionLabel.setLeftIcon(VaadinIcon.BAN);
}

final String message = text;

final Label textLabel = new Label(message);
messageArea.addAndExpand(textLabel);
messageArea.setContent(textLabel);

content.add(messageArea);
content.expand(messageArea);
Expand All @@ -80,9 +78,8 @@ public NotifyDialog(String caption, String text, final Throwable ex, Notificatio
} else {
textLabel.setText(message);
detailsButton.setText("Details");
messageArea.setMargin(true);
setWidth("400px");
setHeight("300px");
setHeight("320px");
}
});

Expand Down
Expand Up @@ -43,6 +43,8 @@ public class ResizableDialog extends Dialog {
protected final Logger log = LoggerFactory.getLogger(getClass());

protected VerticalLayout content;

protected Label captionLabel;

public ResizableDialog() {
this("");
Expand All @@ -53,7 +55,8 @@ public ResizableDialog(String caption) {
setResizable(true);

if (caption != null) {
super.add(new Label(caption + "<hr>"));
captionLabel = new Label(caption + "<hr>");
super.add(captionLabel);
}

content = new VerticalLayout();
Expand Down

0 comments on commit 39f2628

Please sign in to comment.