APISonar


org.pdfsam.support.io.FileType.JSON

> org > pdfsam > support > io > FileType > JSON
org APIs pdfsam APIs support APIs io APIs FileType APIs JSON APIs

Example 1
public void saveWorkspace() {
        RememberingLatestFileChooserWrapper fileChooser = FileChoosers.getFileChooser(
                DefaultI18nContext.getInstance().i18n("Select the workspace file to save"), FileType.JSON);

        latestWorkspace.ifPresentOrElse(f -> {
            fileChooser.setInitialDirectory(f.getParentFile());
            fileChooser.setInitialFileName(f.getName());
        }, () -> fileChooser.setInitialFileName("PDFsam_workspace.json"));

        File chosenFile = fileChooser.showDialog(OpenType.SAVE);
        if (chosenFile != null) {
            latestWorkspace = Optional.of(chosenFile);
            eventStudio().broadcast(new SaveWorkspaceEvent(chosenFile));
        }
    }
Example 2
public PreferenceBrowsableFileField workspace(UserContext userContext) {
        PreferenceBrowsableFileField workspace = new PreferenceBrowsableFileField(StringUserPreference.WORKSPACE_PATH,
                FileType.JSON, OpenType.OPEN, userContext);
        workspace.getTextField().setText(userContext.getDefaultWorkspacePath());
        workspace.setId("workspace");
        workspace.getStyleClass().add("spaced-vitem");
        return workspace;
    }