Package eas.math.fundamentalAlgorithms.graphBased.pdfProcessors

Examples of eas.math.fundamentalAlgorithms.graphBased.pdfProcessors.PDFProcessor


                for (RepresentableAsGraph r : GraphBasedWindow.this.graphTypes) {
                    if (r.isAcceptableCode(scriptText)) {
                        accepted++;
                        try {
                            r.createInstanceFromCode(scriptText);
                            PDFProcessor pdfProcessor = r.generatePDFcode(GeneralDialog.promptForExternalFile(
                                    "TEMP-DIRECTORY",
                                    GlobalVariables.getPrematureParameters().getStdDirectory(),
                                    false).getAbsolutePath());
                            GlobalVariables.getPrematureParameters().logDebug("I finished creating the graph, now it's the turn of '" + pdfProcessor.getClass().getSimpleName() + "'...");

//                            if (!graphVizButton.getText().contains("PlainDOT") || GraphViz.class.isAssignableFrom(pdfProcessor.getClass())) {
//                                graphVizButton.setEnabled(true);
//                            } else {
//                                graphVizButton.setEnabled(false);
//                            }
                           
                            // Ask for very long graphs.
                            if (pdfProcessor.getSourceString().length() > pdfProcessor.getCodeSizeToBeConsideredLarge() && !GeneralDialog.yesNoAnswer(
                                    "Large pdf processor code (greater than " + pdfProcessor.getCodeSizeToBeConsideredLarge() + " characters)",
                                    "The current script leads to a " + pdfProcessor.getClass().getSimpleName() + " code that has " + pdfProcessor.getSourceString().length() + " characters.\n"
                                    + "It might take " + pdfProcessor.getClass().getSimpleName() + " a long time to draw. Proceed?")) {
                                pdfProcessor = new GraphViz(TEMP_DIR.getAbsolutePath());
                                pdfProcessor.addln("digraph G {User aborted...}");
                            }

                            pdfProcessor.storeAsPDF("graph", GeneralDialog.promptForExternalFile(
                                    "TEMP-DIRECTORY",
                                    GlobalVariables.getPrematureParameters().getStdDirectory(),
                                    false).getAbsolutePath());
                           
                            JComponent addInfo = r.getAdditionalInfo();
                            this.addInfo.removeAll();
                            if (addInfo != null) {
                                this.addInfo.add(addInfo);
                                this.addInfo.setVisible(false);
                                this.addInfo.setVisible(true);
                            }
                           
                            GlobalVariables.getPrematureParameters().logDebug(pdfProcessor.getClass().getSimpleName() + " drawing terminated successfully.");
                            this.graphVizButton.setText("Convert to plain " + pdfProcessor.getClass().getSimpleName());
                            this.graphVizButton.setBackground(this.buttonAutoScript.getBackground());
                            this.exceptionThrown = null;
                        } catch (Exception e) {
                            GlobalVariables.getPrematureParameters().logDebug(e.toString());
                            this.graphVizButton.setText("(Could not evaluate)");
View Full Code Here


        } else if (e.getSource().equals(this.graphVizButton) && this.graphVizButton.isEnabled()) {
            if (this.exceptionThrown == null) {
                for (RepresentableAsGraph r : this.graphTypes) {
                    if (r.isAcceptableCode(scriptText)) {
                        r.createInstanceFromCode(scriptText);
                        PDFProcessor gv = r.generatePDFcode(GeneralDialog.promptForExternalFile(
                                "TEMP-DIRECTORY",
                                GlobalVariables.getPrematureParameters().getStdDirectory(),
                                false).getAbsolutePath());
                       
                        if (gv.getSourceString() != null) {
                            String code = gv.getSourceString();
                            if (code.endsWith("\n")) {
                                code = code.substring(0, code.length()-1);
                            }
                            this.getScriptArea().setText(gv.getCodePrefix() + code);
                            this.manageUndo();
                            break;
                        } else {
                            GeneralDialog.message("PDF processor '" + gv.getClass().getSimpleName() + "' does not offer plain source code.", "GraphViz not available");
                        }
                    }
                }
            } else {
                GeneralDialog dia = new GeneralDialog(
View Full Code Here

TOP

Related Classes of eas.math.fundamentalAlgorithms.graphBased.pdfProcessors.PDFProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.