mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 06:18:12 +00:00
Bug 4147 adjusted ConfirmDialog to make integration with What's new
dialog easier
This commit is contained in:
1 parent
930ddfaaaa
commit
e87a5f4ae6
5 files changed
+44
-18
No files matched your search
+3
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.home.shared.partials.dialog;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.google.gwt.user.client.ui.PopupPanel;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
|
||||
/** factory class for confirm dialog with yes/no button */
|
||||
@@ -19,6 +20,8 @@ public final class ConfirmDialogFactory {
|
||||
ConfirmDialogPanel confirmDialogPanel = new ConfirmDialogPanel(message, title, callback, dialog);
|
||||
dialog.setWidget(confirmDialogPanel);
|
||||
confirmDialogPanel.addStyleName(DialogResources.INSTANCE.css().dialog());
|
||||
confirmDialogPanel.setButtonLabels(StringMessages.INSTANCE.yes(), StringMessages.INSTANCE.no());
|
||||
confirmDialogPanel.setFirstButtonDestructive();
|
||||
dialog.addStyleName(DialogResources.INSTANCE.css().backgroundPanel());
|
||||
dialog.show();
|
||||
|
||||
|
||||
+13
-4
@@ -24,10 +24,10 @@ public class ConfirmDialogPanel extends Composite {
|
||||
}
|
||||
|
||||
@UiField
|
||||
Button yesButton;
|
||||
Button firstButton;
|
||||
|
||||
@UiField
|
||||
Button noButton;
|
||||
Button secondButton;
|
||||
|
||||
@UiField
|
||||
DivElement messageField;
|
||||
@@ -51,7 +51,16 @@ public class ConfirmDialogPanel extends Composite {
|
||||
titleField.setInnerText(title);
|
||||
}
|
||||
|
||||
@UiHandler("yesButton")
|
||||
public void setButtonLabels(String firstButtonText, String secondButtonText) {
|
||||
firstButton.setText(firstButtonText);
|
||||
secondButton.setText(secondButtonText);
|
||||
}
|
||||
|
||||
public void setFirstButtonDestructive() {
|
||||
firstButton.addStyleName(DialogResources.INSTANCE.css().yesButton());
|
||||
}
|
||||
|
||||
@UiHandler("firstButton")
|
||||
void onYesClick(ClickEvent e) {
|
||||
if (parent != null) {
|
||||
parent.hide();
|
||||
@@ -59,7 +68,7 @@ public class ConfirmDialogPanel extends Composite {
|
||||
}
|
||||
}
|
||||
|
||||
@UiHandler("noButton")
|
||||
@UiHandler("secondButton")
|
||||
void onNoClick(ClickEvent e) {
|
||||
if (parent != null) {
|
||||
parent.hide();
|
||||
|
||||
+8
-2
@@ -1,13 +1,19 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
|
||||
<ui:with field="res2" type="com.sap.sailing.gwt.common.client.SharedResources" />
|
||||
<ui:with field="res" type="com.sap.sailing.gwt.home.shared.partials.dialog.DialogResources" />
|
||||
<g:HTMLPanel>
|
||||
<div class="{res.css.title}" ui:field="titleField" />
|
||||
<div class="{res.css.message}" ui:field="messageField" />
|
||||
<div class="{res.css.buttonPanel}">
|
||||
<g:Button styleName="{res.css.yesButton} {res.css.button}" ui:field="yesButton">Yes</g:Button>
|
||||
<g:Button styleName="{res.css.noButton} {res.css.button}" ui:field="noButton">No</g:Button>
|
||||
|
||||
<g:Button
|
||||
styleName="{res2.mainCss.button} {res2.mainCss.buttonprimary} {res.css.buttonAdjustments}"
|
||||
ui:field="firstButton" />
|
||||
<g:Button
|
||||
styleName="{res2.mainCss.button} {res2.mainCss.buttonprimaryoutlined} {res.css.buttonAdjustments}"
|
||||
ui:field="secondButton" />
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
+18
-12
@@ -14,22 +14,28 @@
|
||||
box-shadow: 0.1em 0.1em 1em #bbb;
|
||||
}
|
||||
|
||||
@media (max-width: 400px) {
|
||||
.dialog {
|
||||
width: 90%;
|
||||
}
|
||||
.buttonAdjustments {
|
||||
margin-left: .5em;
|
||||
margin-top: .5em;
|
||||
min-width: 11em;
|
||||
}
|
||||
|
||||
@media (min-width: 400px) {
|
||||
.dialog {
|
||||
width: 50%;
|
||||
}
|
||||
@media ( max-width: 400px) {
|
||||
.dialog {
|
||||
width: 90%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.dialog {
|
||||
width: 40%;
|
||||
}
|
||||
@media ( min-width: 400px) {
|
||||
.dialog {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@media ( min-width: 600px) {
|
||||
.dialog {
|
||||
width: 40%;
|
||||
}
|
||||
}
|
||||
|
||||
.message {
|
||||
|
||||
+2
@@ -28,5 +28,7 @@ public interface DialogResources extends ClientBundle {
|
||||
String backgroundPanel();
|
||||
|
||||
String title();
|
||||
|
||||
String buttonAdjustments();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user