Search in sources :

Example 1 with FilterFileModel

use of io.github.vocabhunter.gui.model.FilterFileModel in project VocabHunter by VocabHunter.

the class FilterFileModelTranslatorImpl method translateSession.

private static FilterFileModel translateSession(final BaseListedFile baseListedFile) {
    SessionListedFile file = (SessionListedFile) baseListedFile;
    FilterFileMode mode;
    if (file.isIncludeUnknown()) {
        mode = FilterFileMode.SESSION_SEEN;
    } else {
        mode = FilterFileMode.SESSION_KNOWN;
    }
    return new FilterFileModel(file.getFile(), mode, Collections.emptySet());
}
Also used : FilterFileModel(io.github.vocabhunter.gui.model.FilterFileModel) SessionListedFile(io.github.vocabhunter.analysis.settings.SessionListedFile) FilterFileMode(io.github.vocabhunter.gui.model.FilterFileMode)

Example 2 with FilterFileModel

use of io.github.vocabhunter.gui.model.FilterFileModel in project VocabHunter by VocabHunter.

the class FilterFileModelTranslatorTest method validateToModel.

private void validateToModel(final BaseListedFile file, final FilterFileMode mode, final Set<Integer> columns) {
    FilterFileModel model = target.toModel(file);
    assertEquals(FILE, model.getFile());
    assertEquals(mode, model.getMode());
    assertEquals(columns, model.getColumns());
}
Also used : FilterFileModel(io.github.vocabhunter.gui.model.FilterFileModel)

Example 3 with FilterFileModel

use of io.github.vocabhunter.gui.model.FilterFileModel in project VocabHunter by VocabHunter.

the class FilterFileModelTranslatorTest method testFromSessionKnown.

@Test
public void testFromSessionKnown() {
    FilterFileModel model = new FilterFileModel(FILE, FilterFileMode.SESSION_KNOWN, COLUMNS_EMPTY);
    validateFromModel(model, new SessionListedFile(FILE, false));
}
Also used : FilterFileModel(io.github.vocabhunter.gui.model.FilterFileModel) SessionListedFile(io.github.vocabhunter.analysis.settings.SessionListedFile) Test(org.junit.Test)

Example 4 with FilterFileModel

use of io.github.vocabhunter.gui.model.FilterFileModel in project VocabHunter by VocabHunter.

the class FilterFileModelTranslatorTest method testFromDocument.

@Test
public void testFromDocument() {
    FilterFileModel model = new FilterFileModel(FILE, FilterFileMode.DOCUMENT, COLUMNS_DOCUMENT);
    validateFromModel(model, new DocumentListedFile(FILE));
}
Also used : DocumentListedFile(io.github.vocabhunter.analysis.settings.DocumentListedFile) FilterFileModel(io.github.vocabhunter.gui.model.FilterFileModel) Test(org.junit.Test)

Example 5 with FilterFileModel

use of io.github.vocabhunter.gui.model.FilterFileModel in project VocabHunter by VocabHunter.

the class FilterFileModelTranslatorTest method testFromExcel.

@Test
public void testFromExcel() {
    FilterFileModel model = new FilterFileModel(FILE, FilterFileMode.EXCEL, COLUMNS_EXCEL);
    validateFromModel(model, new ExcelListedFile(FILE, COLUMNS_EXCEL));
}
Also used : ExcelListedFile(io.github.vocabhunter.analysis.settings.ExcelListedFile) FilterFileModel(io.github.vocabhunter.gui.model.FilterFileModel) Test(org.junit.Test)

Aggregations

FilterFileModel (io.github.vocabhunter.gui.model.FilterFileModel)6 Test (org.junit.Test)4 SessionListedFile (io.github.vocabhunter.analysis.settings.SessionListedFile)3 DocumentListedFile (io.github.vocabhunter.analysis.settings.DocumentListedFile)1 ExcelListedFile (io.github.vocabhunter.analysis.settings.ExcelListedFile)1 FilterFileMode (io.github.vocabhunter.gui.model.FilterFileMode)1