Package net.sf.jpluck

Examples of net.sf.jpluck.ClientConfiguration


  }

  public void run() {
    running = true;
    conversionActive = true;
    ClientConfiguration conf = ClientConfiguration.getDefault();
    if (conf.isUseProxy()) {
      System.setProperty("http.proxyHost", conf.getProxyHost());
      System.setProperty("http.proxyPort", String.valueOf(conf.getProxyPort()));
      if (conf.getProxyUser().length() > 0) {
        System.setProperty(HttpClient.PROXY_USER_KEY, conf.getProxyUser());
        System.setProperty(HttpClient.PROXY_PASSWORD_KEY, conf.getProxyPassword());
      }
    }
    LogUtil logUtil = new LogUtil(LogUtil.DEFAULT_LOGGER_NAMES);
    logUtil.setLevel(conf.getLogLevel());
    logUtil.setUseParentHandler(false);
    String logFile = conf.getLogFile();
    FileHandler fileHandler = null;
    if (conf.isLogEnabled() && logFile.length() > 0) {
      try {
        fileHandler = new FileHandler(logFile, conf.getMaxLogSize() * 1024, 1, true);
        fileHandler.setFormatter(new LogFormatter());
        logUtil.addHandler(fileHandler);
      } catch (IOException e) {
        logger.warning("Could not create log file " + e.getMessage());
      }
    }

    for (int i = 0; (i < jxlDocuments.length) && running; i++) {
      try {
        net.sf.jpluck.jxl.Document jxlDocument = jxlDocuments[i];
        if (jxlDocument.getUserAgent() != null) {
          System.setProperty("http.agent", jxlDocument.getUserAgent());
        } else {
          System.setProperty("http.agent", conf.getUserAgent());
        }
        String s = "Starting conversion: " + jxlDocument.getName();
        if (jxlDocument.getJXL() != null) {
          File f = jxlDocument.getJXL().getFile();
          if (f != null) {
View Full Code Here


            String backupDirectory = checkIfFileExists(backupText);
            String cacheDirectory = checkIfFileExists(cacheDirectoryText);
            String cookiesTxt = checkIfFileExists(cookiesTxtText);
            String pluckthisJXL = checkIfFileExists(pluckthisJXLText);

            ClientConfiguration conf = ClientConfiguration.getDefault();
            conf.setCompression(compressionCombo.getSelectedIndex());
            conf.setUseMultiImage(multiImageCheck.isSelected());
            //conf.setUseSegmentLinks(segmentLinksCheck.isSelected());
            conf.setDirectoryDestination(directory);
            if (user != null) {
                conf.setHotSyncDestination(user, memoryCard);
            }
            conf.setCreateCategoryDirectories(categoryDirectoriesCheck.isSelected());
            conf.setDateFormat(DATE_FORMATS[dateFormatCombo.getSelectedIndex()]);
            conf.setUseFeedDate(feedDateCheck.isSelected());
            conf.setGenerateBookmarks(bookmarksCheck.isSelected());

            conf.setMaxConnections(((Integer) maxConnectionsSpinner.getValue()).intValue());
            conf.setTimeout(((Integer) timeoutSpinner.getValue()).intValue());
            conf.setDownloadAttempts(((Integer) downloadAttemptsSpinner.getValue()).intValue());
            String s = acceptCharsetText.getText();
            if (s.length() == 0) {
                s = HttpClient.DEFAULT_ACCEPT_CHARSET;
            }
            conf.setAcceptCharset(s);
            conf.setCacheDirectory(cacheDirectory);
            conf.setCacheExpiration(((Integer) cacheExpirySpinner.getValue()).intValue());
            conf.setAutoCompactCache(compactCacheCheck.isSelected());

            conf.setUseProxy(useProxyCheck.isSelected());
            conf.setProxyHost(proxyHostText.getText());
            conf.setProxyPort(((Integer) proxyPortSpinner.getValue()).intValue());
            conf.setProxyUser(proxyUserText.getText());
            conf.setProxyPassword(new String(proxyPasswordText.getPassword()));

            conf.setLogEnabled(logFileCheck.isSelected());
            conf.setLogFile(logFileText.getText());
            conf.setMaxLogSize(((Integer) logFileSizeSpinner.getValue()).intValue());
            conf.setLogLevel((String) logLevelCombo.getSelectedItem());
            conf.setPluckThisJXL(pluckthisJXL);
            conf.setCookiesTxt(cookiesTxt);

            conf.setLookAndFeel(lafBox.getSelectedLAF().getClassName());
            conf.setPlasticTheme(plasticThemeCombo.getSelectedTheme().getName());
            conf.setAutoCloseConversion(autoCloseCheck.isSelected());
            conf.setDisplayFullFilePath(displayFullFilePathCheck.isSelected());
            conf.setAutoSelectDue(autoSelectDueCheck.isSelected());
            conf.setShowSplashScreen(showSplashScreenCheck.isSelected());
            conf.setConfirmCut(confirmCutCheck.isSelected());
            conf.setMinimizeToTrayIcon(trayIconCheck.isSelected());
            conf.setBrowser(browserText.getText());
            conf.setUseImageIO(imageIOCheck.isSelected());

            conf.setAutoUpdateJXLs(autoUpdatePanel.getFiles());
            conf.setAutoUpdatePeriodEnabled(autoUpdatePeriodCheck.isSelected());
            Period.Time from = Period.Time.fromDate((Date) autoUpdateFromSpinner.getValue());
            Period.Time to = Period.Time.fromDate((Date) autoUpdateToSpinner.getValue());
            conf.setAutoUpdatePeriod(new Period(from, to));
            conf.setAutoUpdateInterval(((Integer) autoUpdateIntervalSpinner.getValue()).intValue());

            activeTab = tabbedPane.getSelectedIndex();
            return true;
        } catch (ValidationException e) {
            e.showMessageDialog();
View Full Code Here

        setLocationRelativeTo(getOwner());
    }

    private void initValues() {
        ClientConfiguration conf = ClientConfiguration.getDefault();
        compressionCombo.setSelectedIndex(conf.getCompression());
        multiImageCheck.setSelected(conf.isUseMultiImage());

        Destination dest = conf.getDestination();
        if (dest != null) {
            hotsyncRadio.setSelected(dest.isHotsync());
            directoryRadio.setSelected(!dest.isHotsync());
            dest = conf.getHotSyncDestination();
            if (dest != null) {
                userCombo.setSelectedItem(dest.getUser());
                memoryCardCheck.setSelected(dest.isMemoryCard());
            }
            dest = conf.getDirectoryDestination();
            if (dest != null) {
                directoryText.setText(dest.getDirectory().getAbsolutePath());
            }
        }

        String backupDirectory = conf.getBackupDirectory();
        if (backupDirectory != null) {
            backupText.setText(backupDirectory);
        }
        categoryDirectoriesCheck.setSelected(conf.isCreateCategoryDirectories());

        String s = conf.getDateFormatName();
        int idx;
        if (s.equals("short")) {
            idx = 0;
        } else if (s.equals("medium")) {
            idx = 1;
        } else if (s.equals("long")) {
            idx = 2;
        } else {
            // Full
            idx = 3;
        }
        dateFormatCombo.setSelectedIndex(idx);
        feedDateCheck.setSelected(conf.isUseFeedDate());
        bookmarksCheck.setSelected(conf.isGenerateBookmarks());

        maxConnectionsSpinner.setValue(new Integer(conf.getMaxConnections()));
        timeoutSpinner.setValue(new Integer(conf.getTimeout()));
        downloadAttemptsSpinner.setValue(new Integer(conf.getDownloadAttempts()));
        acceptCharsetText.setText(conf.getAcceptCharset());
        cacheDirectoryText.setText(conf.getCacheDirectory());
        cacheExpirySpinner.setValue(new Integer(conf.getCacheExpiration()));
        compactCacheCheck.setSelected(conf.isAutoCompactCache());

        useProxyCheck.setSelected(conf.isUseProxy());
        proxyHostText.setText(conf.getProxyHost());
        proxyPortSpinner.setValue(new Integer(conf.getProxyPort()));
        proxyUserText.setText(conf.getProxyUser());
        proxyPasswordText.setText(conf.getProxyPassword());

        logFileCheck.setSelected(conf.isLogEnabled());
        logFileText.setText(conf.getLogFile());
        logFileSizeSpinner.setValue(new Integer(conf.getMaxLogSize()));
        logLevelCombo.setSelectedItem(conf.getLogLevel().getName());
        cookiesTxtText.setText(conf.getCookiesTxt());
        pluckthisJXLText.setText(conf.getPluckThisJXL());

        autoUpdatePanel.setFiles(conf.getAutoUpdateJXLs());
        autoUpdatePeriodCheck.setSelected(conf.isAutoUpdatePeriodEnabled());
        Period period = conf.getAutoUpdatePeriod();
        autoUpdateFromSpinner.setValue(period.getFrom().toDate());
        autoUpdateToSpinner.setValue(period.getTo().toDate());
        autoUpdateIntervalSpinner.setValue(new Integer(conf.getAutoUpdateInterval()));

        lafBox.selectCurrent();
    lafListener = new LAFListener();
    lafBox.addItemListener(lafListener);
        plasticThemeCombo.setSelectedTheme(conf.getPlasticTheme());
        browserText.setText(conf.getBrowser());
        autoCloseCheck.setSelected(conf.isAutoCloseConversion());
        displayFullFilePathCheck.setSelected(conf.isDisplayFullFilePath());
        autoSelectDueCheck.setSelected(conf.isAutoSelectDue());
        showSplashScreenCheck.setSelected(conf.isShowSplashScreen());
        confirmCutCheck.setSelected(conf.isConfirmCut());
        trayIconCheck.setSelected(conf.isMinimizeToTrayIcon());
        imageIOCheck.setSelected(conf.isUseImageIO());

        hotSyncListener.itemStateChanged(null);
        destinationListener.itemStateChanged(null);
        proxyListener.stateChanged(null);
        logListener.stateChanged(null);
View Full Code Here

            args = cl.getArgs();

            for (int i = 0; i < args.length; i++) {
                fileList.add(new File(args[i]));
            }
            ClientConfiguration conf = ClientConfiguration.getDefault();
            if (cl.hasOption("autoupdate")) {
                if (conf.isAutoUpdatePeriodEnabled()) {
                    if (conf.getAutoUpdatePeriod().withinPeriod()) {
                        fileList.addAll(Arrays.asList(conf.getAutoUpdateJXLs()));
                    }
                } else {
                    fileList.addAll(Arrays.asList(conf.getAutoUpdateJXLs()));
                }
            }

            for (int i = 0, n = fileList.size(); i < n; i++) {
                try {
                    File file = (File) fileList.get(i);
                    JXL jxl = new JXL(file);
                    Document[] documents = jxl.getDocumentsToConvert();
                    Arrays.sort(documents);
                    documentList.addAll(Arrays.asList(documents));
                } catch (Exception e) {
                }
            }

            Document[] documents = (Document[]) documentList.toArray(new Document[documentList.size()]);
            if (documents.length == 0) {
                System.exit(ExitCodes.OK);
            }

            Destination destination = Destination.createForDirectory(new File(cl.getOptionValue("destination")));
            Conversion conversion = new Conversion(documents, destination);
            try {
                UIManager.setLookAndFeel(conf.getLookAndFeel());
                conf.applyPlasticTheme();
            } catch (Exception e) {
            }

            conversionFrame = new ConversionFrame(conversion, "JPluck");
            WindowUtil.center(conversionFrame);
View Full Code Here

        } else {
            close = true;
        }
        if (close && (jxl.getFile() != null)) {
            fileHistoryMenu.add(jxl.getFile());
            ClientConfiguration conf = ClientConfiguration.getDefault();
            conf.addToFileHistory(jxl.getFile());
            conf.setLastJXL(jxl.getFile().getAbsolutePath());
            conf.storeTableListWidths(jxl.getFile().getAbsolutePath(), tableList);
        }
        return close;
    }
View Full Code Here

            jxl = new JXL(file);
            setTitle();
            tableList.clearSelection();
            tableList.setTableListModel(jxl);
            tableList.sortByColumn(0);
            ClientConfiguration conf = ClientConfiguration.getDefault();
            conf.restoreTableListWidths(file.getAbsolutePath(), tableList);
            if (conf.isAutoSelectDue()) {
                selectDueAction.actionPerformed(null);
            }
        } catch (Exception e) {
            ExceptionDialog.show(ListFrame.this, e);
        }
View Full Code Here

                            continue;
                        }
                    }
                    jxl.save(file);

                    ClientConfiguration conf = ClientConfiguration.getDefault();
                    conf.setLastDirectory(fileChooser.getCurrentDirectory().getAbsolutePath());
                    setTitle();
                    return true;
                } catch (Exception e) {
                    ExceptionDialog.show(ListFrame.this, e);
                }
View Full Code Here

                if (fileChooser.showOpenDialog(ListFrame.this) == JFileChooser.APPROVE_OPTION) {
                    File file = fileChooser.getSelectedFile();
                    if (file != null) {
                        try {
                            openJXL(file);
                            ClientConfiguration conf = ClientConfiguration.getDefault();
                            conf.setLastDirectory(fileChooser.getCurrentDirectory().getAbsolutePath());
                        } catch (Exception e) {
                            ExceptionDialog.show(ListFrame.this, e);
                        }
                    }
                }
View Full Code Here

    private class AutoUpdateTask extends TimerTask {
        public void run() {
            if (Conversion.isConversionActive()) {
                return;
            }
            ClientConfiguration conf = ClientConfiguration.getDefault();
            if (conf.isAutoUpdatePeriodEnabled() && !conf.getAutoUpdatePeriod().withinPeriod()) {
                return;
            }
            File[] files = conf.getAutoUpdateJXLs();
            Map jxlMap = new HashMap();
            for (Iterator it = listFrameList.iterator(); it.hasNext();) {
                ListFrame listFrame = (ListFrame) it.next();
                JXL jxl = listFrame.getJXL();
                jxlMap.put(jxl.getFile(), jxl);
View Full Code Here

                popup.addMenuItem(exitPopup);
                trayIcon.setPopup(popup);
            } catch (Exception e) {
            }
        }
        ClientConfiguration conf = ClientConfiguration.getDefault();
        conf.restoreAutoUpdateFramePrefs(autoUpdateFrame);
        autoUpdateInterval = conf.getAutoUpdateInterval();
        Preferences prefs = ClientConfiguration.getDefaultPreferencesNode();
        prefs.node("autoupdate").addPreferenceChangeListener(this);
    }
View Full Code Here

TOP

Related Classes of net.sf.jpluck.ClientConfiguration

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.