Skip to content

Commit

Permalink
Bring back titles for Create/Edit filter dialogs
Browse files Browse the repository at this point in the history
Titles got lost during transition to MVP.
  • Loading branch information
mlopatkin committed Apr 6, 2020
1 parent 9c07061 commit d2ebe80
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void addFilter(FilterFromDialog filter) {

@Override
public void createFilterWithDialog(FilterFromDialog baseData) {
dialogFactory.startEditFilterDialog(baseData)
dialogFactory.startCreateFilterDialogWithInitialData(baseData)
.thenAccept(result -> result.ifPresent(this::addFilter))
.exceptionally(Threads::uncaughtException);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,31 @@
import javax.inject.Provider;

public class FilterDialogFactory {
private final Provider<FilterDialog> filterDialogFactory;
private static final String NEW_FILTER_DIALOG_TITLE = "Create new filter";
private static final String EDIT_FILTER_DIALOG_TITLE = "Edit filter";

private final Provider<FilterDialog> filterDialogViewFactory;

@Inject
public FilterDialogFactory(Provider<FilterDialog> filterDialogFactory) {
this.filterDialogFactory = filterDialogFactory;
public FilterDialogFactory(Provider<FilterDialog> filterDialogViewFactory) {
this.filterDialogViewFactory = filterDialogViewFactory;
}

public CompletionStage<Optional<FilterFromDialog>> startCreateFilterDialog() {
return FilterDialogPresenter.create(filterDialogFactory.get()).show();
FilterDialog dialogView = filterDialogViewFactory.get();
dialogView.setTitle(NEW_FILTER_DIALOG_TITLE);
return FilterDialogPresenter.create(dialogView).show();
}

public CompletionStage<Optional<FilterFromDialog>> startCreateFilterDialogWithInitialData(FilterFromDialog filter) {
FilterDialog dialogView = filterDialogViewFactory.get();
dialogView.setTitle(NEW_FILTER_DIALOG_TITLE);
return FilterDialogPresenter.create(dialogView, filter).show();
}

public CompletionStage<Optional<FilterFromDialog>> startEditFilterDialog(FilterFromDialog filter) {
return FilterDialogPresenter.create(filterDialogFactory.get(), filter).show();
FilterDialog dialogView = filterDialogViewFactory.get();
dialogView.setTitle(EDIT_FILTER_DIALOG_TITLE);
return FilterDialogPresenter.create(dialogView, filter).show();
}
}

0 comments on commit d2ebe80

Please sign in to comment.