refactor(presenter): extend base presenter and defer menu actions

This commit is contained in:
2026-08-27 00:10:05 +04:00
parent a7a2953980
commit 140128cde0
2 changed files with 18 additions and 29 deletions
@@ -6,26 +6,25 @@ import ru.project.model.AppState;
import ru.project.student.Student;
import ru.project.view.CollectionView;
public class CollectionPresenter {
public class CollectionPresenter extends BasePresenter {
private final AppState state;
private final CollectionView view;
private final WindowBasedTextGUI gui;
public CollectionPresenter(AppState state, CollectionView view, WindowBasedTextGUI gui) {
this.state = state;
super(state, gui);
this.view = view;
this.gui = gui;
}
@Override
public void start() {
MyList<Student> collection = state.getCollection();
if (collection == null || collection.isEmpty()) {
view.showEmptyMessage(gui);
return;
view.showEmptyMessage();
} else {
view.showCollection(collection);
}
view.showCollection(gui, collection);
view.show(gui);
}
}