Search in sources :

Example 1 with FileDialogue

use of io.github.vocabhunter.gui.dialogues.FileDialogue in project VocabHunter by VocabHunter.

the class FilterGridController method changeFile.

@Override
protected void changeFile(final Stage stage, final FileDialogueFactory factory, final FilterGridModel filterModel) {
    FileDialogue dialogue = factory.create(FileDialogueType.OPEN_WORD_LIST, stage);
    dialogue.showChooser();
    if (dialogue.isFileSelected()) {
        Path file = dialogue.getSelectedFile();
        FileFormatType format = dialogue.getFileFormatType();
        FilterFileMode mode = FileFormatTypeTool.getMode(format);
        TextGrid grid = readGrid(file, mode);
        unbindCheckboxes(filterModel);
        filterModel.replaceContent(file, grid, mode, FilterGridModel.DEFAULT_COLUMNS);
        setupColumnsAndCheckBoxes(filterModel);
    }
}
Also used : Path(java.nio.file.Path) TextGrid(io.github.vocabhunter.analysis.grid.TextGrid) FileDialogue(io.github.vocabhunter.gui.dialogues.FileDialogue) FileFormatType(io.github.vocabhunter.gui.dialogues.FileFormatType) FilterFileMode(io.github.vocabhunter.gui.model.FilterFileMode)

Example 2 with FileDialogue

use of io.github.vocabhunter.gui.dialogues.FileDialogue in project VocabHunter by VocabHunter.

the class SettingsController method processAddSessionFile.

private void processAddSessionFile() {
    FileDialogue dialogue = factory.create(FileDialogueType.OPEN_SESSION, stage);
    dialogue.showChooser();
    if (dialogue.isFileSelected()) {
        FilterFileModel fileModel = new FilterFileModel(dialogue.getSelectedFile(), FilterFileMode.SESSION_KNOWN);
        showHandler(filterSessionHandler, fileModel);
    }
}
Also used : FileDialogue(io.github.vocabhunter.gui.dialogues.FileDialogue)

Example 3 with FileDialogue

use of io.github.vocabhunter.gui.dialogues.FileDialogue in project VocabHunter by VocabHunter.

the class FilterSessionController method changeFile.

@Override
protected void changeFile(final Stage stage, final FileDialogueFactory factory, final FilterSessionModel filterModel) {
    FileDialogue dialogue = factory.create(FileDialogueType.OPEN_SESSION, stage);
    dialogue.showChooser();
    if (dialogue.isFileSelected()) {
        Path file = dialogue.getSelectedFile();
        List<? extends MarkedWord> words = sessionWordsTool.readMarkedWords(file);
        filterModel.replaceContent(file, words);
        buttonKnown.setSelected(true);
    }
}
Also used : Path(java.nio.file.Path) FileDialogue(io.github.vocabhunter.gui.dialogues.FileDialogue)

Example 4 with FileDialogue

use of io.github.vocabhunter.gui.dialogues.FileDialogue in project VocabHunter by VocabHunter.

the class SettingsController method processAddGridFile.

private void processAddGridFile() {
    FileDialogue dialogue = factory.create(FileDialogueType.OPEN_WORD_LIST, stage);
    dialogue.showChooser();
    if (dialogue.isFileSelected()) {
        FileFormatType format = dialogue.getFileFormatType();
        FilterFileMode mode = FileFormatTypeTool.getMode(format);
        FilterFileModel fileModel = new FilterFileModel(dialogue.getSelectedFile(), mode, FilterGridModel.DEFAULT_COLUMNS);
        showHandler(filterGridHandler, fileModel);
    }
}
Also used : FileDialogue(io.github.vocabhunter.gui.dialogues.FileDialogue) FileFormatType(io.github.vocabhunter.gui.dialogues.FileFormatType)

Aggregations

FileDialogue (io.github.vocabhunter.gui.dialogues.FileDialogue)4 FileFormatType (io.github.vocabhunter.gui.dialogues.FileFormatType)2 Path (java.nio.file.Path)2 TextGrid (io.github.vocabhunter.analysis.grid.TextGrid)1 FilterFileMode (io.github.vocabhunter.gui.model.FilterFileMode)1