Package cz.mp.util

Examples of cz.mp.util.Stopwatch


                if (splash == null) {
                    logger.warning("SplashScreen.getSplashScreen() --> null");
               
               
                Stopwatch startupTime = new Stopwatch();
                startupTime.start();

                MainFrame.getInstance().setVisible(true);

                startupTime.stop();

                logger.config("startup in  " +
                        startupTime.getTimeSec() + " s");
               
                if (splash != null && splash.isVisible()) {
                    splash.close();
                }                 
            }
View Full Code Here


        testStateForRun();
       
        // Sem se také zapisuje výstup programu {@code kindlegen}.
        List<String> outputLines = new ArrayList<String>();
        inErrorState = false;
        Stopwatch runtimeStopwatch = new Stopwatch();
        runtimeStopwatch.start();

        try {
            String[] realCommandArray = assembleKindlegenCommandArray();
            logger.info("command:  " + Arrays.toString(realCommandArray));
           
            String readableCommand = createReadableCommand(realCommandArray);
            // (zde možno zapsat readableCommand do skriptu ...)
            writeToCommandOut("> " + readableCommand);

            process = Runtime.getRuntime().exec(realCommandArray);

            InputStream istream = process.getInputStream();
            BufferedReader br = new BufferedReader(
                    new InputStreamReader(istream));

            String line;           
            while ((line = br.readLine()) != null) {
                checkErrorState(line);
                outputLines.add(line);
                logger.fine(line);
                writeToCommandOut(line);
            }

            try {
                process.waitFor();
            } catch (InterruptedException e) {
                setInErrorState(true);
                writeToCommandOut(EOL+"Error: InterruptedException!");
            }
//            if (proc.exitValue() != 0) {}      // nejde, protože kindlegen (v1.2) vrátí vždy 0
          
            br.close();
           
            logger.fine("finished!");
        } catch (IOException ex) {
            logger.warning(ex.toString());
            setInErrorState(true);
            runtime = runtimeStopwatch.stop();
           
            throw ex;
        }      
        runtime = runtimeStopwatch.stop();       
        logger.info("kindlegen runtime = " +
                runtimeStopwatch.getTimeSec() + " s");
       
        return (String[]) outputLines.toArray(new String[0])
    }
View Full Code Here

     *
     */
    BookFiles createBookFiles() {
        BookFiles result = null;

        Stopwatch stopwatch = new Stopwatch();
        stopwatch.start();
       
        if (workingDirField.isSelectedFile()
                && ! bookFilesList.getFiles().isEmpty()
                && tocFileField.isSelectedFile()
                && coverFileField.isSelectedFile()
                ) {
            result = new BookFiles(
                    workingDirField.getSelectedFileAbsolutePath());
            try {
                result.addSrcFiles(bookFilesList.getFiles());
                result.setToc(tocFileField.getSelectedFilePath());
                result.setLoi(loiFileField.getSelectedFilePath());
                result.setPersonalNotes(personalsFileField.getSelectedFilePath());
                result.setColophon(colophonFileField.getSelectedFilePath());
                result.setCoverImage(coverFileField.getSelectedFilePath());
            } catch (IOException ex) {
                logger.warning(ex.toString());
                if (DEBUG) {  ex.printStackTrace()}           
                Dialogs.showErrorDialog(ex);
            }
        }

        stopwatch.stop();
        logger.info("  " + stopwatch.getTimeMs() + " ms");
               
        return result;
    }
View Full Code Here

TOP

Related Classes of cz.mp.util.Stopwatch

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.