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); } } }
private void localProxy(final boolean b) { if (getPluginConfig().getBooleanProperty("STATUS")) { String server = getPluginConfig().getStringProperty("PROXYSERVER", null); int port = getPluginConfig().getIntegerProperty("PROXYPORT", -1); if (isEmpty(server) || port < 0) { return; } server = new Regex(server, "^[0-9a-zA-Z]+://").matches() ? server : "http://" + server; final org.appwork.utils.net.httpconnection.HTTPProxy proxy = org.appwork.utils.net.httpconnection.HTTPProxy.parseHTTPProxy(server + ":" + port); if (b) { if (proxy.getHost() != null || proxy.getHost() != "" && proxy.getPort() > 0) { br.setProxy(proxy); return; } } } br.setProxy(br.getThreadProxy()); }
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); }
public boolean proxyEquals(HTTPProxy a, HTTPProxy b) { if (a == b) { return true; } if (a != null && b != null) { return a.getType() == b.getType() && stringEquals(a.getHost(), b.getHost()) && a.getPort() == b.getPort(); } return false; }