use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.
the class GuiTest method validateSavedSession.
@Override
public void validateSavedSession(final Path file, final String name) {
EnrichedSessionState state = SessionSerialiser.read(file);
assertEquals("Session state name", name, state.getState().getName());
}
use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.
the class GuiFileHandler method processOpenSession.
private void processOpenSession() {
Path file = checkUnsavedChangesAndChooseFile(FileDialogueType.OPEN_SESSION);
if (file == null) {
statusManager.completeAction();
} else {
statusManager.performAction(file);
LOG.info("Opening session file '{}'", file);
GuiTask<EnrichedSessionState> task = new GuiTask<>(guiTaskHandler, statusManager, () -> sessionFileService.read(file), this::finishOpen, e -> FileErrorTool.open(file, e));
guiTaskHandler.executeInBackground(task);
}
}
use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.
the class FileStreamerTest method testEqualSession.
@Test
public void testEqualSession() {
EnrichedSessionState state1 = createNewSession(FILE_TEXT);
EnrichedSessionState state2 = createNewSession(FILE_TEXT);
assertEquals("Equal session", state1, state2);
}
use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.
the class FileStreamerTest method validateSession.
private void validateSession(final String fileName, final String sessionName, final Function<String, EnrichedSessionState> targetMethod) {
EnrichedSessionState session = targetMethod.apply(fileName);
assertEquals("Session name", sessionName, session.getState().getName());
}
use of io.github.vocabhunter.analysis.session.EnrichedSessionState in project VocabHunter by VocabHunter.
the class GuiFileHandler method finishOpen.
private void finishOpen(final EnrichedSessionState enrichedState) {
SessionState state = enrichedState.getState();
SessionModel sessionModel = sessionStateHandler.addSession(state);
model.replaceSessionModel(state, sessionModel, enrichedState.getFile().orElse(null));
statusManager.replaceSession(sessionModel.getPosition(), sessionModel.getProgress());
}
Aggregations