Package jsky.util

Examples of jsky.util.SwingWorker


        final URL rootUrl = new URL(ROOT_URL);
        if (_progressPanel == null) {
            _progressPanel = ProgressPanel.makeProgressPanel("Updating list of available VO registries from: "
                    + rootUrl.getHost(), this);
        }
        new SwingWorker() {
            public Object construct() {
                try {
                    AstroCatConfig.getConfigFile(); // make sure the current catalog list is read in
                    _progressPanel.start();
                    return RegistryQuery.getSearchableRegistries(ROOT_URL);
View Full Code Here


                }
            }
        }

        // Add any checked catalog dirs (this can take some time, so use background threads)
        new SwingWorker() {
            public Object construct() {
                try {
                    for (String urlStr : map.keySet()) {
                        String name = map.get(urlStr);
                        URL url = new URL(urlStr);
View Full Code Here

        if (_queryResultDisplay == null) {
            return;
        }

        // run in a separate thread, so the user can monitor progress and cancel it, if needed
        _worker = new SwingWorker() {
            // Query arguments can be modified, for example if an object name is resolved to RA,Dec
            private QueryArgs _queryArgs;

            public Object construct() {
                try {
View Full Code Here

        _historyList.addToHistory();
        _url = _origURL = url;
        _filename = null;
        initProgressPanel();

        _worker = new SwingWorker() {

            public Object construct() {
                setDownloadState(true);
                try {
                    ProgressBarFilterInputStream in = _progressPanel.getLoggedInputStream(url);
View Full Code Here

     * @param url points to the image file
     */
    protected void downloadImageToTempFile(final URL url) {
        //System.out.println("XXX downloadImageToTempFile: " + url);
        initProgressPanel();
        _worker = new SwingWorker() {

            String filename;

            public Object construct() {
                setDownloadState(true);
View Full Code Here

        if (isLocal) {
            setComponent(makeQueryResultComponent(queryResult));
        } else {
            // remote catalog: run in a separate thread, so the user can monitor progress
            makeProgressPanel();
            _worker = new SwingWorker() {
                public Object construct() {
                    try {
                        return makeQueryResultComponent(_queryResult);
                    } catch (Exception e) {
                        return e;
View Full Code Here

    /**
     * Display a preview of the image to be printed in a popup window.
     **/
    public void preview() {
        SwingWorker worker = new SwingWorker() {
            public Object construct() {
                try {
                    String title = _imageDisplay.getObjectName();
                    if (title == null)
                        title = _imageDisplay.getFilename();
                    if (title == null)
                        title = _I18N.getString("printPreview");
                    startPrint(_I18N.getString("preparingImage"));
                    return new PrintPreview(ImagePrintDialog.this, ImagePrintDialog.this, title);
                } catch (Exception e) {
                    return e;
                }
            }

            public void finished() {
                _progressPanel.stop();
                _progressPanel.setTitle(_I18N.getString("printingImage"));
                Object o = getValue();
                if (o instanceof Exception) {
                    DialogUtil.error((Exception) o);
                } else if (o instanceof PrintPreview) {
                    PrintPreview pp = (PrintPreview) o;
                    pp.setVisible(true);
                }
            }
        };
        worker.start();
    }
View Full Code Here

                    if (stream != null) {
                        stream.interrupt();
                        stream = null;
                    }
                    stream = new ProgressBarFilterInputStream(statusPanel, url);
                    SwingWorker worker = new SwingWorker() {

                        public Object construct() {
                            while (true) {
                                try {
                                    //thread.sleep(1);
                                    if (stream.read() == -1)
                                        return null;
                                } catch (Exception ex) {
                                    return null;
                                }
                            }
                        }
                    };
                    worker.start();
                } else if (w == stopButton) {
                    if (stream != null) {
                        stream.interrupt();
                        stream = null;
                    } else {
View Full Code Here

                    if (stream != null) {
                        stream.interrupt();
                        stream = null;
                    }
                    stream = new ProgressBarFilterInputStream(statusPanel, url);
                    SwingWorker worker = new SwingWorker() {

                        public Object construct() {
                            while (true) {
                                try {
                                    //thread.sleep(1);
                                    if (stream.read() == -1)
                                        return null;
                                } catch (Exception ex) {
                                    return null;
                                }
                            }
                        }
                    };
                    worker.start();
                } else if (w == stopButton) {
                    if (stream != null) {
                        stream.interrupt();
                        stream = null;
                    } else {
View Full Code Here

    }

    // Loads the catalog directory in a background thread and then updates the tree
    private void _loadCatalogDirectory() {
        // Load the catalog information in a background thread, since it could hang, if not cached
        new SwingWorker() {
            public Object construct() {
                try {
                    return CatalogNavigator.getCatalogDirectory();
                } catch (Exception e) {
                    return e;
View Full Code Here

TOP

Related Classes of jsky.util.SwingWorker

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.