[rfc][icedtea-web] make download indicator more compact

Adam Domurad adomurad at redhat.com
Thu Jan 10 07:56:46 PST 2013


On 01/10/2013 09:33 AM, Jiri Vanek wrote:
[ .. large snip .. ]
> On 01/09/2013 08:45 PM, Adam Domurad wrote:
>> On 01/08/2013 11:06 AM, Jiri Vanek wrote:
>>> +                //When just one is added then it behaves as was 
>>> costumed (and no show detail button)
>>
>> Sorry, I do not understand this last sentence (at least not the way 
>> its worded).

Ok you explained it on IRC :-) but still needs to be fixed. "When only 
one jar is downloaded then its progress is shown, and there is no show 
detail button" makes sense to me. (assuming I interpreted correctly, I 
haven't seen it with a 1-jar download yet)

>>> +                //be two or more jars, so it swap to collapsed 
>>> state in count of two.
>>> +                //no later, no sooner
>>> +                if (panels.size() == 2){
>>> +                    remove(panels.get(0));
>>> +                    remove(panels.get(1));
>>> +                    remove(delimiter);
>>> +                    add(detailsButton,vertical);
>>> +                    mainProgressPanel=new ProgressPanel();
>>> +                    add(mainProgressPanel, verticalIndent);
>>> +                    state=States.COLLAPSED;
>>> +                }
>>>                  synchronized (frameMutex) {
>>>                      frame.pack();
>>> +                    placeFrameToLowerRight();
>>>                  }
>>>
>>> -                urls.add(url);
>>> -                panels.add(panel);
>>>              }
>>>          }
>>>
>>> @@ -219,10 +312,10 @@
>>>                          addProgressPanel(url, version);
>>>
>>>                      setOverallPercent(overallPercent);
>>> -
>>>                      ProgressPanel panel = 
>>> panels.get(urls.indexOf(url));
>>>                      panel.setProgress(readSoFar, total);
>>>                      panel.repaint();
>>> +
>>>                  }
>>>              };
>>>              SwingUtilities.invokeLater(r);
>>> @@ -230,12 +323,27 @@
>>>
>>>          /**
>>>           * Sets the overall percent completed.
>>> +         * should be called via invokeLater
>>>           */
>>>          public void setOverallPercent(int percent) {
>>>              // don't get whole string from resource and sub in
>>>              // values because it'll be doing a MessageFormat for
>>>              // each update.
>>>              header.setText(downloading + " " + downloadName + ": " 
>>> + percent + "% " + complete +
>>> ".");
>>> +            Container c = header.getParent();
>>> +            //we need to adapt both panels and also frame to new 
>>> length of header text
>>> +            while (c != null) {
>>> +                c.invalidate();
>>> +                c.validate();
>>> +                if (c instanceof  Window){
>>> +                    ((Window) c).pack();
>>> +                }
>>> +                c=c.getParent();
>>> +            }
>>> +            if (mainProgressPanel != null) {
>>> +                mainProgressPanel.setProgress(percent, 100);
>>> +                mainProgressPanel.repaint();
>>> +            }
>>>          }
>>>
>>>          /**
>>> @@ -276,12 +384,28 @@
>>>
>>>          private long total;
>>>          private long readSoFar;
>>> +        private Dimension size = new Dimension(80, 15);
>>>
>>> +        ProgressPanel() {
>>> +            bar.setMinimumSize(size);
>>> +            bar.setPreferredSize(size);
>>> +            bar.setOpaque(false);
>>> +
>>> +            setLayout(new GridBagLayout());
>>> +
>>> +            GridBagConstraints gbc = new GridBagConstraints();
>>> +            styleGridBagConstraints(gbc);
>>> +            add(bar, gbc);
>>> +        }
>>> +
>>>          ProgressPanel(URL url, String version) {
>>> -            JLabel location = new JLabel(" " + url.getHost() + "/" 
>>> + url.getFile());
>>> +            this(" " + url.getHost() + "/" + url.getFile(),version);
>>> +        }
>>> +        ProgressPanel(String caption, String version) {
>>> +            JLabel location = new JLabel(caption);
>>>
>>> -            bar.setMinimumSize(new Dimension(80, 15));
>>> -            bar.setPreferredSize(new Dimension(80, 15));
>>> +            bar.setMinimumSize(size);
>>> +            bar.setPreferredSize(size);
>>>              bar.setOpaque(false);
>>>
>>>              setLayout(new GridBagLayout());
>>> @@ -291,12 +415,8 @@
>>>              gbc.fill = GridBagConstraints.NONE;
>>>              gbc.gridwidth = GridBagConstraints.RELATIVE;
>>>              add(bar, gbc);
>>> -
>>> -            gbc.insets = new Insets(0, 3, 0, 0);
>>> -            gbc.weightx = 1.0;
>>> -            gbc.fill = GridBagConstraints.HORIZONTAL;
>>> -            gbc.gridwidth = GridBagConstraints.REMAINDER;
>>> -            gbc.anchor = GridBagConstraints.WEST;
>>> +
>>> +            styleGridBagConstraints(gbc);
>>>              add(location, gbc);
>>>          }
>>>
>>> @@ -325,6 +445,14 @@
>>>                  g.fillRect(x + 1, y + 1, divide - 1, h - 1);
>>>              }
>>>          }
>>> +
>>> +        private void styleGridBagConstraints(GridBagConstraints gbc) {
>>> +            gbc.insets = new Insets(0, 3, 0, 0);
>>> +            gbc.weightx = 1.0;
>>> +            gbc.fill = GridBagConstraints.HORIZONTAL;
>>> +            gbc.gridwidth = GridBagConstraints.REMAINDER;
>>> +            gbc.anchor = GridBagConstraints.WEST;
>>> +        }
>>>      };
>>>
>>>  }
>>
>> Attached are two alternate icons. They are from here 
>> http://opengameart.org/content/forum-controls
>> and are in the public domain.
>
> ok.. I dont like the aluminium magnify glass :)

Whatever works :-)

>
> I was thinking about some simple + and - also - you can see how it 
> resulted at "*2.png versions" not nice:(
>
> then I took  your arrow idea and I think the result is pretty nice.
>
> What do you think now?

It's good now, I like it.

>
> (just note, smaller arrow and bigger arrow are intentional:)
>>
>> The magnifying glass can go compact->detailed, and the left&up arrow 
>> can go detailed->compact. Maybe
>> get rid of the surrounding buttons as well (or make them more subtle) ?
>
> What do you mean?

Just having a clickable image seems better to me than having the swing 
button.

>>
>
> Patch with updated names of icons and fixed typos attached.
>

It's good now though, please do push! (just fix that one sentence).
-Adam



More information about the distro-pkg-dev mailing list