Search in sources :

Example 1 with FileChooserAdapter

use of com.kotcrab.vis.ui.widget.file.FileChooserAdapter in project gdx-graph by MarcinSc.

the class LibgdxGraphScreen method exportShader.

private void exportShader() {
    FileChooser fileChooser = new FileChooser(FileChooser.Mode.SAVE);
    fileChooser.setModal(true);
    fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
    fileChooser.setListener(new FileChooserAdapter() {

        @Override
        public void selected(Array<FileHandle> file) {
            FileHandle selectedFile = file.get(0);
            if (!selectedFile.name().toLowerCase().endsWith(".json")) {
                selectedFile = selectedFile.parent().child(selectedFile.name() + ".json");
            }
            writeGraph(selectedFile, ((GraphDesignTab) tabbedPane.getActiveTab()).serializeGraph());
        }
    });
    getStage().addActor(fileChooser.fadeIn());
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) FileChooser(com.kotcrab.vis.ui.widget.file.FileChooser) FileChooserAdapter(com.kotcrab.vis.ui.widget.file.FileChooserAdapter)

Example 2 with FileChooserAdapter

use of com.kotcrab.vis.ui.widget.file.FileChooserAdapter in project gdx-graph by MarcinSc.

the class LibgdxGraphScreen method saveAs.

private void saveAs() {
    FileChooser fileChooser = new FileChooser(FileChooser.Mode.SAVE);
    fileChooser.setModal(true);
    fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
    fileChooser.setListener(new FileChooserAdapter() {

        @Override
        public void selected(Array<FileHandle> file) {
            FileHandle selectedFile = file.get(0);
            if (!selectedFile.name().toLowerCase().endsWith(".json")) {
                selectedFile = selectedFile.parent().child(selectedFile.name() + ".json");
            }
            editedFile = selectedFile;
            saveToFile(graphDesignTab, selectedFile);
        }
    });
    getStage().addActor(fileChooser.fadeIn());
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) FileChooser(com.kotcrab.vis.ui.widget.file.FileChooser) FileChooserAdapter(com.kotcrab.vis.ui.widget.file.FileChooserAdapter)

Example 3 with FileChooserAdapter

use of com.kotcrab.vis.ui.widget.file.FileChooserAdapter in project gdx-graph by MarcinSc.

the class LibgdxGraphScreen method open.

private void open() {
    if (graphDesignTab != null && graphDesignTab.isDirty()) {
        Dialogs.showErrorDialog(getStage(), "Current pipeline has been modified, close it or save it");
    } else {
        removeAllTabs();
        FileChooser fileChooser = new FileChooser(FileChooser.Mode.OPEN);
        fileChooser.setModal(true);
        fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
        fileChooser.setListener(new FileChooserAdapter() {

            @Override
            public void selected(Array<FileHandle> file) {
                FileHandle selectedFile = file.get(0);
                loadPipelineFromFile(selectedFile);
                editedFile = selectedFile;
                graphDesignTab.setDirty(false);
            }
        });
        getStage().addActor(fileChooser.fadeIn());
    }
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) FileChooser(com.kotcrab.vis.ui.widget.file.FileChooser) FileChooserAdapter(com.kotcrab.vis.ui.widget.file.FileChooserAdapter)

Example 4 with FileChooserAdapter

use of com.kotcrab.vis.ui.widget.file.FileChooserAdapter in project talos by rockbite.

the class BatchConvertDialog method showFolderSelect.

private void showFolderSelect(final TextField pathField) {
    fileChooser.setMode(FileChooser.Mode.OPEN);
    fileChooser.setMultiSelectionEnabled(false);
    fileChooser.setSelectionMode(FileChooser.SelectionMode.DIRECTORIES);
    fileChooser.setListener(new FileChooserAdapter() {

        @Override
        public void selected(Array<FileHandle> file) {
            pathField.setText(file.get(0).path());
        }
    });
    getStage().addActor(fileChooser.fadeIn());
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) FileChooserAdapter(com.kotcrab.vis.ui.widget.file.FileChooserAdapter)

Example 5 with FileChooserAdapter

use of com.kotcrab.vis.ui.widget.file.FileChooserAdapter in project talos by rockbite.

the class NewProjectDialog method showFolderSelect.

private void showFolderSelect() {
    fileChooser.setMode(FileChooser.Mode.OPEN);
    fileChooser.setMultiSelectionEnabled(false);
    fileChooser.setSelectionMode(FileChooser.SelectionMode.DIRECTORIES);
    fileChooser.setListener(new FileChooserAdapter() {

        @Override
        public void selected(Array<FileHandle> file) {
            parentPathField.setText(file.get(0).path());
        }
    });
    getStage().addActor(fileChooser.fadeIn());
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) FileChooserAdapter(com.kotcrab.vis.ui.widget.file.FileChooserAdapter)

Aggregations

FileChooserAdapter (com.kotcrab.vis.ui.widget.file.FileChooserAdapter)18 FileHandle (com.badlogic.gdx.files.FileHandle)16 FileChooser (com.kotcrab.vis.ui.widget.file.FileChooser)9 Array (com.badlogic.gdx.utils.Array)5 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)4 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)4 File (java.io.File)3 FileFilter (java.io.FileFilter)3 IProject (com.talosvfx.talos.editor.project.IProject)2 Pixmap (com.badlogic.gdx.graphics.Pixmap)1 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)1 JsonReader (com.badlogic.gdx.utils.JsonReader)1 JsonValue (com.badlogic.gdx.utils.JsonValue)1 Menu (com.kotcrab.vis.ui.widget.Menu)1 MenuItem (com.kotcrab.vis.ui.widget.MenuItem)1 FileTypeFilter (com.kotcrab.vis.ui.widget.file.FileTypeFilter)1 ShaderNodeStage (com.talosvfx.talos.editor.addons.shader.workspace.ShaderNodeStage)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1