-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cancel confirmation dialog to most dialog winows (#655)
* add notifications before canceling project/experiment creation or editing * clean up imports * remove unused Action * reuse code, add cancel notification to more dialogs * some css changes * Hacky solution for footer items in confirm dialog * review changes --------- Co-authored-by: Sven F <[email protected]> Co-authored-by: Steffengreiner <[email protected]>
- Loading branch information
1 parent
e028e64
commit 739c989
Showing
15 changed files
with
245 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...rface/src/main/java/life/qbic/datamanager/views/CancelConfirmationNotificationDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package life.qbic.datamanager.views; | ||
|
||
import com.vaadin.flow.component.button.Button; | ||
import com.vaadin.flow.component.html.Span; | ||
import com.vaadin.flow.component.icon.Icon; | ||
import com.vaadin.flow.component.icon.VaadinIcon; | ||
import life.qbic.datamanager.views.notifications.NotificationDialog; | ||
|
||
/** | ||
* Warns the user that they are about to cancel a dialog and lose input data | ||
* <p> | ||
* This dialog is to be shown when a dialog is canceled via the Esc key or the Cancel button | ||
*/ | ||
public class CancelConfirmationNotificationDialog extends NotificationDialog { | ||
|
||
public CancelConfirmationNotificationDialog() { | ||
customizeHeader(); | ||
setCancelable(true); | ||
Button redButton = new Button("Discard"); | ||
redButton.addClassName("danger"); | ||
setConfirmButton(redButton); | ||
Button cancelButton = new Button("Continue"); | ||
setCancelButton(cancelButton); | ||
} | ||
|
||
public CancelConfirmationNotificationDialog withBodyText(String mainText) { | ||
content.removeAll(); | ||
content.add(new Span(mainText)); | ||
return this; | ||
} | ||
|
||
public CancelConfirmationNotificationDialog withConfirmText(String confirmText) { | ||
setConfirmText(confirmText); | ||
return this; | ||
} | ||
|
||
public CancelConfirmationNotificationDialog withTitle(String headerText) { | ||
setTitle(headerText); | ||
return this; | ||
} | ||
|
||
private void customizeHeader() { | ||
Icon errorIcon = new Icon(VaadinIcon.WARNING); | ||
errorIcon.setClassName("warning-icon"); | ||
setHeaderIcon(errorIcon); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.