public void saveGraphAs(Graph graph, Component c) {
        this.graph = graph;
        JFileChooser fileChooser = new JFileChooser();
        if (graph instanceof PetriNet) {
            fileChooser.setAcceptAllFileFilterUsed(false);
            fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("Danes PetriNet files", "dpn"));
            fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("CoBA PetriNet files", "pn2"));
            fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("CPN Tools PetriNet files", "cpn"));
        } else {
            fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("PrecedenceGraph", "dpg"));
        }
        int showOpenDialog = fileChooser.showSaveDialog(c);
        setSelectedFile(fileChooser.getSelectedFile());
        if (selectedFile == null) {
            return;
        }
        if (!selectedFile.exists()) {
            setSelectedFile(new File(getSelectedFile().getAbsolutePath()));
            try {
                getSelectedFile().createNewFile();
            } catch (IOException e) {
                System.out.print("Chyba pri praci so suborom");
            }
        }
        FileFilter ff = fileChooser.getFileFilter();
        if (getSelectedFile() != null) {
            getInfoAboutFile(getSelectedFile());
            if (showOpenDialog != JFileChooser.APPROVE_OPTION) {
                return;
            }
            checkAndSave(getSelectedFile(), ff);
        }
    }