Package penny.downloadmanager.model.db

Examples of penny.downloadmanager.model.db.Download


            public void run() {
                goButton.setText("Stop");
                download = null;
                try {
                    download = new Download();
                    download.setUrl(new URL(addressBox.getText()));
                    download.addPropertyChangeListener(ConnectionTest.this);
                } catch (MalformedURLException ex) {
                    Logger.getLogger(ConnectionTest.class.getName()).log(Level.SEVERE, null, ex);
                }
View Full Code Here


    public void setDownloadTable(JTable downloadTable) {
        this.downloadTable = downloadTable;
    }

    public void add(URL url) {
        Download d = new Download(UUID.randomUUID());
        d.setUrl(url);
        mainModel.getDownloads().add(d);
    }
View Full Code Here

            int changeType = listChanges.getType();

            switch (changeType) {
                case ListEvent.DELETE:
                    changeList.getReadWriteLock().readLock().lock();
                    Download d1 = (Download) listChanges.getOldValue();
                    changeList.getReadWriteLock().readLock().unlock();

                    d1.removePropertyChangeListener(this);
                    md5ValuesMap.remove(d1);
                    linkStateValuesMap.remove(d1);

                    if (saveDelete) {
                        dao.deleteDownload(d1.getId());
                    }


                    WordSaver wordSaver = wordSavers.get(d1);
                    d1.removeWordsListener(wordSaver);
                    wordSavers.remove(d1);

                    HrefLinkSaver hrefSaver = hrefSavers.get(d1);
                    d1.removeHrefLinksListener(hrefSaver);
                    hrefSavers.remove(d1);

                    SrcLinkSaver srcSaver = srcSavers.get(d1);
                    d1.removeSrcLinksListener(srcSaver);
                    srcSavers.remove(d1);

                    LocationSaver locationSaver = locationSavers.get(d1);
                    d1.removeSrcLinksListener(locationSaver);
                    locationSavers.remove(d1);
                    break;
                case ListEvent.INSERT:
                    changeList.getReadWriteLock().readLock().lock();
                    Download d2 = (Download) changeList.get(sourceIndex);
                    changeList.getReadWriteLock().readLock().unlock();

                    d2.addPropertyChangeListener(this);
                    dao.insertDownload(d2);

                    wordSavers.put(d2, new WordSaver(d2));
                    hrefSavers.put(d2, new HrefLinkSaver(d2));
                    srcSavers.put(d2, new SrcLinkSaver(d2));
                    locationSavers.put(d2, new LocationSaver(d2));
                    break;
                case ListEvent.UPDATE:

                    changeList.getReadWriteLock().readLock().lock();
                    Download d3 = (Download) changeList.get(sourceIndex);
                    changeList.getReadWriteLock().readLock().unlock();

                    updateMD5(d3);
                    updateLinkState(d3);
                    break;
View Full Code Here

        }
    }

    @Override
    public void propertyChange(PropertyChangeEvent evt) {
        Download d = (Download) evt.getSource();

        if (saveProps.contains(evt.getPropertyName())) {
            dao.updateDownload(d, evt.getPropertyName());
        }
//        else if (evt.getPropertyName().equals(Download.PROP_SRCLINKS)) {
View Full Code Here

    public void clearCompleteDownloads() {
        downloadSaver.setSaveDelete(false);
        downloads.getReadWriteLock().writeLock().lock();
        List<Download> remove = new ArrayList<Download>();
        for(int i = 0; i < downloads.size(); i++) {
            Download j = downloads.get(i);
            if(j.getStatus() == DownloadStatus.COMPLETE) {
                remove.add(j);
            }
        }
        for(Download d : remove) {
            Util.remove(new File(d.getTempPath()));
View Full Code Here

    public void clearErrorDownloads() {
        downloadSaver.setSaveDelete(false);
        downloads.getReadWriteLock().writeLock().lock();
        List<Download> remove = new ArrayList<Download>();
        for(int i = 0; i < downloads.size(); i++) {
            Download j = downloads.get(i);
            if(j.getStatus() == DownloadStatus.ERROR) {
                remove.add(j);
            }
        }
        for(Download d : remove) {
            Util.remove(new File(d.getTempPath()));
View Full Code Here

    /**
     * @param selectedDownload the selectedDownload to set
     */
    public void setSelectedDownload(Download selectedDownload) {
        Download oldValue = this.selectedDownload;
        this.selectedDownload = selectedDownload;
        propertySupport.firePropertyChange(PROP_SELDOWNLOAD, oldValue, selectedDownload);
    }
View Full Code Here

    /**
     * @param download the download to set
     */
    public void setDownload(Download download) {
        Download oldValue = this.download;
        this.download = download;
        propertySupport.firePropertyChange(PROP_DOWNLOAD, oldValue, download);
    }
View Full Code Here

        propertySupport.firePropertyChange(PROP_SIZE, oldValue, links.size());
    }

    public boolean moveOneLink() {
        try {
            Download download = new Download(UUID.randomUUID());
            download.setUrl(new URL(links.pop()));
            Model.getDownloads().add(download);
            int oldValue = progress;
            progress++;
            propertySupport.firePropertyChange(PROP_PROGRESS, oldValue, progress);
        } catch (MalformedURLException ex) {
View Full Code Here

TOP

Related Classes of penny.downloadmanager.model.db.Download

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.