~ubuntu-branches/ubuntu/oneiric/icedtea-web/oneiric

« back to all changes in this revision

Viewing changes to netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-11-24 13:23:28 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101124132328-2xb9z39vxga63vr9
Tags: 1.0~20101124-0ubuntu1
* Update to hg 20101124.
* Fix xulrunner dependencies for natty.
* Build-depend on pkg-config and libgtk2.0-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
package net.sourceforge.jnlp.cache;
19
19
 
 
20
import static net.sourceforge.jnlp.runtime.Translator.R;
 
21
 
20
22
import java.awt.*;
21
23
import java.awt.event.*;
22
24
import java.net.*;
49
51
    // todo: this should be synchronized at some point but conflicts
50
52
    // aren't very likely.
51
53
 
52
 
    private static String downloading = JNLPRuntime.getMessage("CDownloading");
53
 
    private static String complete = JNLPRuntime.getMessage("CComplete");
 
54
    private static String downloading = R("CDownloading");
 
55
    private static String complete = R("CComplete");
54
56
 
55
57
    /** time to wait after completing but before window closes */
56
58
    private static final int CLOSE_DELAY = 750;
118
120
                              screen.height-frame.getHeight());
119
121
        }
120
122
 
121
 
        frame.show();
 
123
        frame.setVisible(true);
122
124
 
123
125
        return result;
124
126
    }
135
137
        ActionListener hider = new ActionListener() {
136
138
            public void actionPerformed(ActionEvent evt) {
137
139
                if (frame.getContentPane().getComponentCount() == 1)
138
 
                    frame.hide();
 
140
                    frame.setVisible(false);
139
141
 
140
142
                frame.getContentPane().remove((DownloadPanel) listener);
141
143
                frame.pack();
161
163
        private JLabel header = new JLabel();
162
164
 
163
165
        /** list of URLs being downloaded */
164
 
        private List urls = new ArrayList();
 
166
        private List<URL> urls = new ArrayList<URL>();
165
167
 
166
168
        /** list of ProgressPanels */
167
 
        private List panels = new ArrayList();
 
169
        private List<ProgressPanel> panels = new ArrayList<ProgressPanel>();
168
170
 
169
171
 
170
172
        /**
199
201
        /**
200
202
         * Update the download progress of a url.
201
203
         */
202
 
        protected void update(final URL url, final String version, final long readSoFar, final long total, final int overallPercent) {
 
204
        protected void update(final URL url, final String version,
 
205
                              final long readSoFar, final long total,
 
206
                              final int overallPercent) {
203
207
            Runnable r = new Runnable() {
204
208
                public void run() {
205
209
                    if (!urls.contains(url))
207
211
 
208
212
                    setOverallPercent(overallPercent);
209
213
 
210
 
                    ProgressPanel panel = (ProgressPanel) panels.get(urls.indexOf(url));
 
214
                    ProgressPanel panel = panels.get(urls.indexOf(url));
211
215
                    panel.setProgress(readSoFar, total);
212
216
                    panel.repaint();
213
217
                }