+ // filter to display only custom urls
+ final RowFilter<TableModel, Object> customUrlFilter = new RowFilter<TableModel, Object>()
+ {
+ @Override
+ public boolean include(
+ Entry<? extends TableModel, ? extends Object> entry)
+ {
+ return ((UrlLinkTableModel) entry.getModel()).isUserEntry(entry);
+ }
+ };
+
+ final TableRowSorter<TableModel> customSorter = new TableRowSorter<>(
+ linkUrlTable.getModel());
+ customSorter.setRowFilter(customUrlFilter);
+
+ ActionListener onCustomOnly;
+ onCustomOnly = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ filterTB.setText("");
+ sorter.setRowFilter(customUrlFilter);
+ }
+ };
+ userOnly.addActionListener(onCustomOnly);
+
+ filterTB.getDocument().addDocumentListener(new DocumentListener()
+ {
+ String caseInsensitiveFlag = "(?i)";
+
+ @Override
+ public void changedUpdate(DocumentEvent e)
+ {
+ sorter.setRowFilter(RowFilter
+ .regexFilter(caseInsensitiveFlag + filterTB.getText()));
+ }
+
+ @Override
+ public void removeUpdate(DocumentEvent e)
+ {
+ sorter.setRowFilter(RowFilter
+ .regexFilter(caseInsensitiveFlag + filterTB.getText()));
+ }
+
+ @Override
+ public void insertUpdate(DocumentEvent e)
+ {
+ sorter.setRowFilter(RowFilter
+ .regexFilter(caseInsensitiveFlag + filterTB.getText()));
+ }
+ });
+
+ // set up list selection functionality
+ linkUrlTable.getSelectionModel()
+ .addListSelectionListener(new UrlListSelectionHandler());
+
+ // set up radio buttons
+ int onClickCol = ((UrlLinkTableModel) linkUrlTable.getModel())
+ .getPrimaryColumn();
+ String onClickName = linkUrlTable.getColumnName(onClickCol);
+ linkUrlTable.getColumn(onClickName)
+ .setCellRenderer(new RadioButtonRenderer());
+ linkUrlTable.getColumn(onClickName)
+ .setCellEditor(new RadioButtonEditor());
+
+ // get boolean columns and resize those to min possible
+ for (int column = 0; column < linkUrlTable.getColumnCount(); column++)
+ {
+ if (linkUrlTable.getModel().getColumnClass(column)
+ .equals(Boolean.class))
+ {
+ TableColumn tableColumn = linkUrlTable.getColumnModel()
+ .getColumn(column);
+ int preferredWidth = tableColumn.getMinWidth();
+
+ TableCellRenderer cellRenderer = linkUrlTable.getCellRenderer(0,
+ column);
+ Component c = linkUrlTable.prepareRenderer(cellRenderer, 0, column);
+ int cwidth = c.getPreferredSize().width
+ + linkUrlTable.getIntercellSpacing().width;
+ preferredWidth = Math.max(preferredWidth, cwidth);
+
+ tableColumn.setPreferredWidth(preferredWidth);
+ }
+ }
+
+ String proxyTypeString = Cache.getDefault("USE_PROXY", "false");
+ previousProxyType = proxyTypeString;
+ switch (proxyTypeString)
+ {
+ case Cache.PROXYTYPE_NONE:
+ proxyType.setSelected(noProxy.getModel(), true);
+ break;
+ case Cache.PROXYTYPE_SYSTEM:
+ proxyType.setSelected(systemProxy.getModel(), true);
+ break;
+ case Cache.PROXYTYPE_CUSTOM:
+ proxyType.setSelected(customProxy.getModel(), true);
+ break;
+ default:
+ Cache.log.warn(
+ "Incorrect PROXY_TYPE - should be 'none' (clear proxy properties), 'false' (system settings), 'true' (custom settings): "
+ + proxyTypeString);
+ }
+ proxyServerHttpTB.setText(Cache.getDefault("PROXY_SERVER", ""));
+ proxyPortHttpTB.setText(Cache.getDefault("PROXY_PORT", ""));
+ proxyServerHttpsTB.setText(Cache.getDefault("PROXY_SERVER_HTTPS", ""));
+ proxyPortHttpsTB.setText(Cache.getDefault("PROXY_PORT_HTTPS", ""));
+ proxyAuth.setSelected(Cache.getDefault("PROXY_AUTH", false));
+ proxyAuthUsernameTB
+ .setText(Cache.getDefault("PROXY_AUTH_USERNAME", ""));
+ // we are not storing or retrieving proxy password from .jalview_properties
+ proxyAuthPasswordPB.setText(Cache.proxyAuthPassword == null ? ""
+ : new String(Cache.proxyAuthPassword));
+ setCustomProxyEnabled();