Skip to content

Commit 3be1102

Browse files
committed
Replace resultAction with onResult in dialog
1 parent 0b593a2 commit 3be1102

12 files changed

Lines changed: 20 additions & 20 deletions

File tree

tabshell-core/src/main/java/com/techsenger/tabshell/core/dialog/AbstractDialogPresenter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void setDisabled(boolean disabled) {
5858
}
5959
}
6060

61-
private Consumer<ResultButtonName> resultAction = (name) -> closeSafely();
61+
private Consumer<ResultButtonName> onResult = (name) -> closeSafely();
6262

6363
private boolean active;
6464

@@ -266,13 +266,13 @@ public Icon<?> getIcon() {
266266
}
267267

268268
@Override
269-
public Consumer<ResultButtonName> getResultAction() {
270-
return resultAction;
269+
public Consumer<ResultButtonName> getOnResult() {
270+
return onResult;
271271
}
272272

273273
@Override
274-
public void setResultAction(Consumer<ResultButtonName> resultAction) {
275-
this.resultAction = resultAction;
274+
public void setOnResult(Consumer<ResultButtonName> resultAction) {
275+
this.onResult = resultAction;
276276
}
277277

278278
@Override
@@ -294,8 +294,8 @@ protected void restoreAppearance() {
294294
}
295295

296296
protected void onResult(ResultButtonName name) {
297-
if (this.resultAction != null) {
298-
this.resultAction.accept(name);
297+
if (this.onResult != null) {
298+
this.onResult.accept(name);
299299
}
300300
}
301301

tabshell-core/src/main/java/com/techsenger/tabshell/core/dialog/DialogPort.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface DialogPort extends DialogShared, PopupPort {
3939
*
4040
* @return the result action consumer, or {@code null} if the default close behavior is used
4141
*/
42-
Consumer<ResultButtonName> getResultAction();
42+
Consumer<ResultButtonName> getOnResult();
4343

4444
/**
4545
* Sets the action to be executed when a result button is clicked.
@@ -51,7 +51,7 @@ public interface DialogPort extends DialogShared, PopupPort {
5151
*
5252
* @param action the result action consumer, or {@code null} to reset to the default close behavior
5353
*/
54-
void setResultAction(Consumer<ResultButtonName> action);
54+
void setOnResult(Consumer<ResultButtonName> action);
5555

5656
/**
5757
* Returns whether this dialog is active.

tabshell-demo/src/main/java/com/techsenger/tabshell/demo/browser/MenuAwareAreaPresenter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected void onBarIncludedSelected(boolean value) {
7676

7777
protected void onDialogOpen(OverlayScope scope) {
7878
var dialog = getView().getComposer().openDemoDialog(scope, true);
79-
dialog.setResultAction((name) -> {
79+
dialog.setOnResult((name) -> {
8080
if (name == DemoResultButtons.OK) {
8181
dialog.closeSafely();
8282
}

tabshell-demo/src/main/java/com/techsenger/tabshell/demo/dialogs/DialogsDialogPresenter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ protected void postInitialize() {
107107
setResizable(true);
108108
setTitle("Dialogs");
109109
view.setDialogTypes(Arrays.asList(DialogType.values()));
110-
setResultAction((result) -> {
110+
setOnResult((result) -> {
111111
closeSafely();
112112
});
113113
setRightButtons(DialogsDialogButtons.CLOSE);
@@ -131,7 +131,7 @@ private void showFileChooserDialog(FileChooserType type) {
131131
this.storageRegistry.refreshDefaultStorages();
132132
var params = new FileChooserDialogParams(type, this.storageRegistry.getAllStorages(), settings, historyManager);
133133
var port = getView().getComposer().openFileChooserDialog(params);
134-
port.setResultAction((buttonName) -> {
134+
port.setOnResult((buttonName) -> {
135135
if (buttonName == FileChooserDialogButtons.OK) {
136136
var result = port.getResult();
137137
System.out.println("Result: " + result.getUri());

tabshell-demo/src/main/java/com/techsenger/tabshell/demo/ide/IdeMainTabPresenter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected ComponentDescriptor createDescriptor() {
9595

9696
protected void onDialogOpen() {
9797
var dialog = getView().getComposer().openDemoDialog(true);
98-
dialog.setResultAction((name) -> {
98+
dialog.setOnResult((name) -> {
9999
if (name == DemoResultButtons.OK) {
100100
dialog.closeSafely();
101101
}

tabshell-demo/src/main/java/com/techsenger/tabshell/demo/page/PageDialogPresenter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void prepareToClose(Consumer<ClosePreparationResult> resultCallback) {
5353
protected void postInitialize() {
5454
super.postInitialize();
5555
getView().setTitle("Page Dialog");
56-
setResultAction((button) -> closeSafely());
56+
setOnResult((button) -> closeSafely());
5757
setRightButtons(PageDialogButtons.OK);
5858
setButtonDefault(PageDialogButtons.OK, true);
5959
setMinWidth(500);

tabshell-demo/src/main/java/com/techsenger/tabshell/demo/theme/ThemeDialogPresenter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected void postInitialize() {
7070
getView().setTheme(settings.getTheme());
7171
setRightButtons(ThemeDialogButtons.CANCEL, ThemeDialogButtons.OK);
7272
setButtonDefault(ThemeDialogButtons.OK, true);
73-
setResultAction((buttonName) -> {
73+
setOnResult((buttonName) -> {
7474
if (buttonName == ThemeDialogButtons.OK) {
7575
settings.setTheme(this.theme);
7676
}

tabshell-devtools/src/main/java/com/techsenger/tabshell/devtools/node/EnumEditorDialogPresenter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class EnumEditorDialogPresenter<V extends EnumEditorDialogView> extends A
3333

3434
public EnumEditorDialogPresenter(V view, EditorDialogParams params) {
3535
super(view, params);
36-
setResultAction((button) -> {
36+
setOnResult((button) -> {
3737
if (button == EditorDialogButtons.OK) {
3838
try {
3939
applyValue(getTask(), value);

tabshell-devtools/src/main/java/com/techsenger/tabshell/devtools/node/InsetEditorDialogPresenter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class InsetEditorDialogPresenter<V extends InsetEditorDialogView> extends
3535

3636
public InsetEditorDialogPresenter(V view, EditorDialogParams params) {
3737
super(view, params);
38-
setResultAction((button) -> {
38+
setOnResult((button) -> {
3939
if (button == EditorDialogButtons.OK) {
4040
try {
4141
var value = top + "," + right + "," + bottom + "," + left;

tabshell-devtools/src/main/java/com/techsenger/tabshell/devtools/node/TextEditorDialogPresenter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class TextEditorDialogPresenter<V extends TextEditorDialogView> extends A
3232

3333
public TextEditorDialogPresenter(V view, EditorDialogParams params) {
3434
super(view, params);
35-
setResultAction((button) -> {
35+
setOnResult((button) -> {
3636
if (button == EditorDialogButtons.OK) {
3737
try {
3838
applyValue(getTask(), value);

0 commit comments

Comments
 (0)