use of io.github.vocabhunter.analysis.session.SessionState in project VocabHunter by VocabHunter.
the class AnalysisSystemTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
Analyser analyser = new SimpleAnalyser();
FileStreamer target = new FileStreamer(analyser);
URL resource = FileStreamerTest.class.getResource("/" + INPUT_DOCUMENT);
Path file = Paths.get(resource.toURI());
EnrichedSessionState enrichedSession = target.createNewSession(file);
SessionState sessionState = enrichedSession.getState();
words = sessionState.getOrderedUses();
}
use of io.github.vocabhunter.analysis.session.SessionState in project VocabHunter by VocabHunter.
the class SelectionExportToolTest method testSelection.
@Test
public void testSelection() throws Exception {
SessionState state = state(word("Out1", WordState.KNOWN), word("In1", WordState.UNKNOWN), word("Out2", WordState.UNSEEN), word("In2", WordState.UNKNOWN));
validate(state, "In1", "In2");
}
use of io.github.vocabhunter.analysis.session.SessionState in project VocabHunter by VocabHunter.
the class GuiFileHandler method processSave.
private void processSave() {
Path file = model.getSessionFile();
statusManager.performAction(file);
LOG.info("Saving file '{}'", file);
SessionState sessionState = sessionStateHandler.getSessionState();
GuiTask<Boolean> task = new GuiTask<>(guiTaskHandler, statusManager, () -> saveFile(file, sessionState), b -> model.setChangesSaved(true), e -> FileErrorTool.save(file, e));
guiTaskHandler.executeInBackground(task);
}
use of io.github.vocabhunter.analysis.session.SessionState in project VocabHunter by VocabHunter.
the class GuiFileHandler method processExport.
private void processExport() {
Path file = chooseFile(FileDialogueType.EXPORT_SELECTION);
if (file == null) {
statusManager.completeAction();
} else {
statusManager.performAction(file);
Path fileWithSuffix = FileNameTool.ensureExportFileHasSuffix(file);
SessionState sessionState = sessionStateHandler.getSessionState();
GuiTask<Boolean> task = new GuiTask<>(guiTaskHandler, statusManager, () -> processExport(fileWithSuffix, sessionState), e -> FileErrorTool.export(fileWithSuffix, e));
guiTaskHandler.executeInBackground(task);
}
}
use of io.github.vocabhunter.analysis.session.SessionState in project VocabHunter by VocabHunter.
the class SelectionExportToolTest method state.
private SessionState state(final SessionWord... words) {
SessionState bean = new SessionState();
bean.setOrderedUses(listOf(words));
return bean;
}
Aggregations