parent
deefacbb49
commit
99cc213ef1
@ -0,0 +1,15 @@ |
|||||||
|
package de.kreth.vaadin.clubhelper.vaadinclubhelper; |
||||||
|
|
||||||
|
public class ClubhelperException extends Exception { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 8677112373849590712L; |
||||||
|
|
||||||
|
public ClubhelperException(String message, Throwable cause) { |
||||||
|
super(message, cause); |
||||||
|
} |
||||||
|
|
||||||
|
public ClubhelperException(String message) { |
||||||
|
super(message); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,38 @@ |
|||||||
|
package de.kreth.vaadin.clubhelper.vaadinclubhelper.ui; |
||||||
|
|
||||||
|
import java.io.PrintWriter; |
||||||
|
import java.io.StringWriter; |
||||||
|
|
||||||
|
import com.vaadin.shared.ui.ContentMode; |
||||||
|
import com.vaadin.ui.Button; |
||||||
|
import com.vaadin.ui.Label; |
||||||
|
import com.vaadin.ui.UI; |
||||||
|
import com.vaadin.ui.VerticalLayout; |
||||||
|
import com.vaadin.ui.Window; |
||||||
|
|
||||||
|
public class ClubhelperErrorDialog { |
||||||
|
|
||||||
|
private final Window errorDlg = new Window("Fehler"); |
||||||
|
|
||||||
|
public ClubhelperErrorDialog(String errormessage, Exception exception) { |
||||||
|
VerticalLayout layout = new VerticalLayout(); |
||||||
|
layout.addComponent(new Label(errormessage)); |
||||||
|
layout.addComponent(new Label(exception.getMessage())); |
||||||
|
StringWriter out = new StringWriter(); |
||||||
|
PrintWriter writer = new PrintWriter(out); |
||||||
|
exception.printStackTrace(writer); |
||||||
|
layout.addComponent(toComponent(out)); |
||||||
|
layout.addComponent(new Button("Schließen", event -> errorDlg.close())); |
||||||
|
errorDlg.setContent(layout); |
||||||
|
} |
||||||
|
|
||||||
|
public Label toComponent(StringWriter out) { |
||||||
|
Label label = new Label(out.toString()); |
||||||
|
label.setContentMode(ContentMode.PREFORMATTED); |
||||||
|
return label; |
||||||
|
} |
||||||
|
|
||||||
|
public void show(UI ui) { |
||||||
|
ui.addWindow(errorDlg); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
package de.kreth.vaadin.clubhelper.vaadinclubhelper.business; |
||||||
|
|
||||||
|
public interface ThrowingRunnable<E extends Exception> { |
||||||
|
|
||||||
|
void run() throws E; |
||||||
|
} |
||||||
Loading…
Reference in new issue