public void configureRendererComponent(AbstractNode value, boolean isSelected, boolean hasFocus, int row, int column) { if (value instanceof DownloadLink) { DownloadLink dlLink = (DownloadLink) value; DownloadInterface dli = dlLink.getDownloadInstance(); SingleDownloadController sdc = dlLink.getDownloadLinkController(); int index = 0; if (dlLink.isSkipped()) { labels[index].setIcon(skipped); labels[index].setVisible(true); index++; } if (dlWatchdog.isLinkForced(dlLink)) { labels[index].setIcon(forced); labels[index].setVisible(true); index++; } if (dlLink.isResumeable()) { labels[index].setIcon(resumeIndicator); labels[index].setVisible(true); index++; } if (dli != null && sdc != null) { HTTPProxy proxy = sdc.getCurrentProxy(); if (proxy != null && proxy.isRemote()) { labels[index].setIcon(proxyConnection); labels[index].setVisible(true); } else { labels[index].setIcon(directConnection); labels[index].setVisible(true); } index++; if (sdc.getAccount() != null) { labels[index].setIcon(accountInUse); labels[index].setVisible(true); index++; } labels[index].setText("" + dli.getManagedConnetionHandler().size()); labels[index].setIcon(connections); labels[index].setVisible(true); } } }
public ConnectionTooltip(DownloadLink link) { JLabel lbl; this.panel = new TooltipPanel("ins 3,wrap 1", "[grow,fill]", "[grow,fill]"); DownloadInterface dli = link.getDownloadInstance(); SingleDownloadController sdc = link.getDownloadLinkController(); { if (dlWatchdog.isLinkForced(link)) { panel.add(lbl = new JLabel(_GUI._.ConnectionColumn_DownloadIsForced(), forced, JLabel.LEADING)); SwingUtils.setOpaque(lbl, false); lbl.setForeground(new Color(this.getConfig().getForegroundColor())); } if (link.isSkipped()) { panel.add(lbl = new JLabel(_GUI._.ConnectionColumn_DownloadIsSkipped(), skipped, JLabel.LEADING)); SwingUtils.setOpaque(lbl, false); lbl.setForeground(new Color(this.getConfig().getForegroundColor())); } /* is the Link resumeable */ if (link.isResumeable()) { panel.add(lbl = new JLabel(_GUI._.ConnectionColumn_DownloadIsResumeable(), resumeIndicator, JLabel.LEADING)); SwingUtils.setOpaque(lbl, false); lbl.setForeground(new Color(this.getConfig().getForegroundColor())); } } if (sdc != null) { { /* connection? */ HTTPProxy proxy = sdc.getCurrentProxy(); if (proxy == null) proxy = HTTPProxy.NONE; panel.add(lbl = new JLabel(_GUI._.ConnectionColumn_getStringValue_connection(proxy), proxy.isRemote() ? proxyConnection : directConnection, JLabel.LEADING)); SwingUtils.setOpaque(lbl, false); lbl.setForeground(new Color(this.getConfig().getForegroundColor())); } if (sdc.getAccount() != null) { /* account in use? */ panel.add(lbl = new JLabel(_GUI._.ConnectionColumn_DownloadUsesAccount(sdc.getAccount().getUser()), accountInUse, JLabel.LEADING)); SwingUtils.setOpaque(lbl, false); lbl.setForeground(new Color(this.getConfig().getForegroundColor())); } } if (dli != null) { panel.add(lbl = new JLabel(_GUI._.ConnectionColumn_getStringValue_chunks(dli.getManagedConnetionHandler().size()), connections, JLabel.LEADING)); SwingUtils.setOpaque(lbl, false); lbl.setForeground(new Color(this.getConfig().getForegroundColor())); } this.panel.setOpaque(false); if (panel.getComponentCount() > 0) add(panel); }