Search in sources :

Example 1 with FlameFileChooser

use of org.jwildfire.create.tina.swing.FlameFileChooser in project JWildfire by thargor6.

the class MutaGenController method loadFlameFromFileBtn_clicked.

public void loadFlameFromFileBtn_clicked() {
    try {
        JFileChooser chooser = new FlameFileChooser(prefs);
        if (prefs.getInputFlamePath() != null) {
            try {
                chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        if (chooser.showOpenDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
            File file = chooser.getSelectedFile();
            List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
            Flame flame = flames.get(0);
            prefs.setLastInputFlameFile(file);
            if (flame != null) {
                importFlame(flame);
            }
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameReader(org.jwildfire.create.tina.io.FlameReader) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 2 with FlameFileChooser

use of org.jwildfire.create.tina.swing.FlameFileChooser in project JWildfire by thargor6.

the class IFlamesController method saveIFlameButton_clicked.

public void saveIFlameButton_clicked() {
    try {
        if (getFlame() != null) {
            JFileChooser chooser = new FlameFileChooser(prefs);
            if (prefs.getOutputFlamePath() != null) {
                try {
                    chooser.setCurrentDirectory(new File(prefs.getOutputFlamePath()));
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            if (chooser.showSaveDialog(centerPanel) == JFileChooser.APPROVE_OPTION) {
                File file = chooser.getSelectedFile();
                new FlameWriter().writeFlame(getFlame(), file.getAbsolutePath());
                getFlame().setLastFilename(file.getName());
                messageHelper.showStatusMessage(getFlame(), "flame saved to disc");
                prefs.setLastOutputFlameFile(file);
            }
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : FlameWriter(org.jwildfire.create.tina.io.FlameWriter) JFileChooser(javax.swing.JFileChooser) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) File(java.io.File)

Example 3 with FlameFileChooser

use of org.jwildfire.create.tina.swing.FlameFileChooser in project JWildfire by thargor6.

the class DancingFractalsController method loadFlameButton_clicked.

public void loadFlameButton_clicked() {
    try {
        JFileChooser chooser = new FlameFileChooser(prefs);
        if (prefs.getInputFlamePath() != null) {
            try {
                chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        chooser.setMultiSelectionEnabled(true);
        if (chooser.showOpenDialog(poolFlamePreviewPnl) == JFileChooser.APPROVE_OPTION) {
            for (File file : chooser.getSelectedFiles()) {
                List<Flame> newFlames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
                prefs.setLastInputFlameFile(file);
                if (newFlames != null && newFlames.size() > 0) {
                    for (Flame newFlame : newFlames) {
                        project.getFlames().add(validateDancingFlame(newFlame));
                    }
                }
            }
            refreshProjectFlames();
            enableControls();
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameReader(org.jwildfire.create.tina.io.FlameReader) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Example 4 with FlameFileChooser

use of org.jwildfire.create.tina.swing.FlameFileChooser in project JWildfire by thargor6.

the class BatchRendererController method batchRenderAddFilesButton_clicked.

public void batchRenderAddFilesButton_clicked() {
    if (jobRenderThread != null) {
        return;
    }
    try {
        JFileChooser chooser = new FlameFileChooser(prefs);
        if (prefs.getInputFlamePath() != null) {
            try {
                chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        int jobCount = batchRenderList.size();
        chooser.setMultiSelectionEnabled(true);
        if (chooser.showOpenDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
            for (File file : chooser.getSelectedFiles()) {
                addFlameToBatchRenderer(file.getPath(), false);
            }
        }
        if (jobCount != batchRenderList.size()) {
            refreshRenderBatchJobsTable();
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) File(java.io.File)

Example 5 with FlameFileChooser

use of org.jwildfire.create.tina.swing.FlameFileChooser in project JWildfire by thargor6.

the class MeshGenController method loadFlameButton_clicked.

public void loadFlameButton_clicked() {
    try {
        JFileChooser chooser = new FlameFileChooser(prefs);
        if (prefs.getInputFlamePath() != null) {
            try {
                chooser.setCurrentDirectory(new File(prefs.getInputFlamePath()));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
        if (chooser.showOpenDialog(rootPanel) == JFileChooser.APPROVE_OPTION) {
            File file = chooser.getSelectedFile();
            List<Flame> flames = new FlameReader(prefs).readFlames(file.getAbsolutePath());
            Flame newFlame = flames.get(0);
            prefs.setLastInputFlameFile(file);
            importFlame(newFlame);
        }
    } catch (Throwable ex) {
        errorHandler.handleError(ex);
    }
}
Also used : JFileChooser(javax.swing.JFileChooser) FlameReader(org.jwildfire.create.tina.io.FlameReader) FlameFileChooser(org.jwildfire.create.tina.swing.FlameFileChooser) File(java.io.File) Flame(org.jwildfire.create.tina.base.Flame) RenderedFlame(org.jwildfire.create.tina.render.RenderedFlame)

Aggregations

File (java.io.File)9 JFileChooser (javax.swing.JFileChooser)9 FlameFileChooser (org.jwildfire.create.tina.swing.FlameFileChooser)9 Flame (org.jwildfire.create.tina.base.Flame)6 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)6 FlameReader (org.jwildfire.create.tina.io.FlameReader)5 FlameWriter (org.jwildfire.create.tina.io.FlameWriter)2 PostRecordFlameGenerator (org.jwildfire.create.tina.dance.action.PostRecordFlameGenerator)1 ThumbnailCacheKey (org.jwildfire.create.tina.swing.ThumbnailCacheKey)1