Package eas.miscellaneous.system

Examples of eas.miscellaneous.system.FileNamePostfixFilter


                    dia = new FileDialog(this,
                                         "Automatendarstellung als PNG "
                                         + "speichern",
                                         FileDialog.SAVE);
                   
                    dia.setFilenameFilter(new FileNamePostfixFilter("png"));
                   
                    dia.setVisible(true);

                    if (!(dia.getDirectory() == null)
                        && !(dia.getFile() == null)) {
View Full Code Here


    private int filesFinished;

    @Override
    public void runBeforeSimulation(EnvironmentEA umg, ParCollection params) {
        super.runBeforeSimulation(umg, params);
        storedRuns = new File(params.getStdDirectory()).listFiles(new FileNamePostfixFilter("gz"));
        filesFinished = 0;
    }
View Full Code Here

                           final boolean erreichbar,
                           final String  verzeichnis) {
       
        File verz = new File(verzeichnis);
        String endung = eas.startSetup.marbBuilder.ConstantsGraphVis.GRAPH_ENDUNG;
        String[] gespGr = verz.list(new FileNamePostfixFilter(endung));
        ArrayList<Integer> a;
        Iterator<Integer> it2;
        int anzahl = 0;
        RobEA aktRob;
        Knoten l;
View Full Code Here

            }
        }

        // JAR-Dateien kopieren.
        final File rootPfad = new File(".");
        zwisch = rootPfad.listFiles(new FileNamePostfixFilter("jar"));
        for (final File f : zwisch) {
            final File f2 = new File(
                    zielVerz.getAbsolutePath()
                            + File.separatorChar
                            + f.getName());
View Full Code Here

                TraceBetrachter.main(paramsTrace);
            }
        } else if (arg0.getActionCommand().equals(COMBINE_STATISTICS_XML_STRING)) {
            final JFileChooser dia = new JFileChooser();
            final FileNamePostfixFilter filter = new FileNamePostfixFilter("txt");
            filter.setVerzZulassen(true);
            dia.setDialogTitle(
                    "Dateien zum Zusammenfassen auswählen");
            dia.setCurrentDirectory(new File(pars.getStdDirectory()));
            dia.setBounds(0, 0, 800, 600);
            dia.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
View Full Code Here

            FileDialog dia = new FileDialog(
                    this,
                    "Save environment view as pdf (works with AbstractEnvironment2D<?> only)...",
                    FileDialog.SAVE);

            dia.setFilenameFilter(new FileNamePostfixFilter("pdf"));

            dia.setVisible(true);

            if (dia.getDirectory() != null && dia.getFile() != null) {
                StaticMethods.saveEnvironmentViewAsPDF(
                        new File(dia.getDirectory() + "/" + dia.getFile()),
                        // dia.getFiles()[0],
                        (AbstractEnvironment2D<?>) this.liveWindow.vidParent
                                .getEnvironment(), new DefaultFontMapper());
            }
            if (!pause) {
                liveWindow.vidParent.depause();
            }
        } else if (arg0.getActionCommand().equals(this.saveString)) {
            AllroundVideoPlugin vid = this.videoPlugin;
            if (vid != null) {
                vid.pause();

                // Ask for executable simState.
                String butt1 = "SimState only";
                String butt2 = "Executable SimState";
                String text = "Saving the simState allows to continue the simulation at another time and on another computer.\n"
                        + "However, problems may occur if the EAS version to run the simulation on is different from the current.\n \n"
                        + "Choose \"" + butt1 + "\" to keep track of the EAS version yourself or \"" + butt2 + "\" to create a package\n"
                        + "containing EAS and everything else required to load the simState including an executable batch file\n"
                        + "(only available when not already running an exectuable simState).";
                String[] buttons = {butt1, GeneralDialog.CANCEL};
                File testFile = new File("./" + GlobalVariables.ROOT_PACKAGE_NAME);
               
                if (testFile.exists() && testFile.isDirectory()) {
                    buttons = new String[] {butt1, butt2, GeneralDialog.CANCEL};
                }
               
                GeneralDialog dia2 = new GeneralDialog(
                        null,
                        text,
                        "Save simState on its own or create executable simState (may take a bit)?",
                        buttons,
                        null);
               
                dia2.setVisible(true);

                if (dia2.getResult().equals(GeneralDialog.CANCEL)) {
                    return;
                }
               
                // Ask for location.
                FileDialog dia = new FileDialog(this, "Select a place to store simulation state", FileDialog.SAVE);
                dia.setFilenameFilter(new FileNamePostfixFilter(".eas"));
                dia.setVisible(true);

                if (dia.getDirectory() != null && dia.getFile() != null) {
                    File easFile;
                    if (dia.getFile().endsWith(".eas")) {
View Full Code Here

       
        // Export plugins.
        if (e.getSource().equals(buttOK)) {
            FileDialog dia = new FileDialog(this.myStarter, "Choose JAR file to store plugins", FileDialog.SAVE);
            frame.dispose();
            dia.setFilenameFilter(new FileNamePostfixFilter(".jar"));
            dia.setVisible(true);

            if (dia.getDirectory() == null || dia.getFile() == null) {
                return;
            }
           
            File storeFile = new File(dia.getDirectory() + File.separator + dia.getFile());
      @SuppressWarnings("deprecation")
            Object[] selected = list.getSelectedValues();
            String dirPrefixPlugin = dirPrefix;
            StaticMethods.delDir(new File(dirPrefix));
           
            for (Object o : selected) {
              Class<Plugin<?>> c = (Class<Plugin<?>>) o;
             
              try {
                    dirPrefixPlugin = dirPrefix + c.newInstance().id() + "/";
                } catch (Exception e2) {
                    throw new RuntimeException("Plugin instance not created.");
                }
              File dir = new File(dirPrefixPlugin + "/" + c.getPackage().getName().replace('.', '/'));
              File dirOwn = new File("./" + c.getPackage().getName().replace('.', '/'));
              FileCopy copy = new FileCopy();
              dir.mkdirs();
             
              try {
          copy.copyFolder(dirOwn, dir, true, false);
        } catch (IOException e1) {
          GlobalVariables.getPrematureParameters().logError("Could not copy directory '" + dirOwn + "':" + e1.getMessage() + "\n" + Arrays.deepToString(e1.getStackTrace()).replace(',', '\n'));
          GlobalVariables.getPrematureParameters().logInfo("Plugin export aborted due to errors.");
          return;
        }
            }
           
            try {
        ZipIt.createJARfromDirectory(dirPrefix, storeFile, null);
      } catch (IOException e1) {
        GlobalVariables.getPrematureParameters().logError("Could not create JAR file '" + storeFile + "'.");
      }
           
            StaticMethods.delDir(new File(dirPrefix));
           
            GlobalVariables.getPrematureParameters().logInfo("Plugin JAR file '" + storeFile + "' exported.");
           
            GeneralDialog dia2 = new GeneralDialog(
                myStarter,
                null,
                "Export successful (" + selected.length + " plugins)",
                GeneralDialog.OK_BUTT,
                "Plugin JAR file '" + storeFile + "' exported:\n\n- " + Arrays.deepToString(selected).replace("[", "").replace("]", "").replace(", ", "\n- "));
            dia2.setVisible(true);
           
            return;
        } else if (e.getSource().equals(buttCancel)) {
            frame.dispose();
            return;
        }
       
        myStarter.actionPerformed(e);
       
        if (e.getActionCommand().equals(Starter.EXIT_STRING)) {
            myStarter.dispose();
            System.exit(0);
        } else if (e.getActionCommand().equals(Starter.LOAD_STORED_SIMULATION)) {
            if (loadSimState()) {
                this.myStarter.dispose();
            }
        } else if (e.getActionCommand().equals(Starter.EXPORT_PLUGINS_STRING)) {
            frame = new JDialog(myStarter, Starter.EXPORT_PLUGINS_STRING + " NOTE: all necessary classes have to be located in the package of the main plugin class.");
            JPanel panel = new JPanel(new GridLayout(2, 1));
            Object[] items = convertListToArray(getSharablePlugins());
            list = new JList(items);
            JScrollPane jScrollPane1 = new JScrollPane(list);
            panel.add(jScrollPane1);
           
            JPanel mainPanel = new JPanel();
            JPanel panel1 = new JPanel(new GridLayout(1, 4));
            panel1.add(buttOK);
            panel1.add(buttCancel);
           
            buttOK.addActionListener(this);
            buttCancel.addActionListener(this);
           
            panel.add(mainPanel);
            mainPanel.add(panel1);
           
            frame.getContentPane().add(panel);
            frame.setSize(750, 400);
            frame.setVisible(true);
        } else if (e.getActionCommand().equals(Starter.IMPORT_PLUGINS_STRING)) {
           
            // User selects file to import.
            FileDialog dia = new FileDialog(this.myStarter, "Choose JAR file to store plugins", FileDialog.LOAD);
            dia.setFilenameFilter(new FileNamePostfixFilter(".jar"));
            dia.setVisible(true);

            if (dia.getDirectory() == null || dia.getFile() == null) {
                return;
            }
View Full Code Here

        }
    }

    public static boolean loadSimState() {
        FileDialog dia = new FileDialog((JFrame) null, "Select a simulation to load", FileDialog.LOAD);
        dia.setFilenameFilter(new FileNamePostfixFilter(".eas"));
        dia.setVisible(true);

        if (dia.getDirectory() == null || dia.getFile() == null) {
            return false;
        }
View Full Code Here

     * @return  Die Anzahl an Robotern, die vom Plugin geladen werden.
     */
    public int anzRob(final ParCollection params) {
        File verz = new File(params.getStdDirectory());
        String endung = eas.startSetup.marbBuilder.ConstantsGraphVis.GRAPH_ENDUNG;
        String[] gespGr = verz.list(new FileNamePostfixFilter(endung));
        if (gespGr == null) {
            return 0;
        } else {
            return gespGr.length;
        }
View Full Code Here

     * Verzeichnis.
     */
    private void ladeGraphen(final EnvironmentEA umg) {
        File verz = new File(this.pars.getStdDirectory());
        String endung = eas.startSetup.marbBuilder.ConstantsGraphVis.GRAPH_ENDUNG;
        String[] gespGr = verz.list(new FileNamePostfixFilter(endung));
        String grNam;
        VisMantel visRob = null;
        boolean sel = false;
       
        if (gespGr != null) {
View Full Code Here

TOP

Related Classes of eas.miscellaneous.system.FileNamePostfixFilter

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.