tabbedPane.add(initConnectionsTab(),
MessageManager.getString("label.connections"));
+ tabbedPane.add(initLinksTab(),
+ MessageManager.getString("label.urllinks"));
+
tabbedPane.add(initOutputTab(),
MessageManager.getString("label.output"));
});
JPanel proxyPanel = initConnTabProxyPanel();
- JPanel linkPanel = initConnTabUrlLinks();
initConnTabCheckboxes();
- // Add URL link panel
- connectTab.add(linkPanel, new GridBagConstraints(0, 0, 2, 1, 2.0, 2.0,
- GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(
- 16, 0, 0, 12), 359, 32));
-
// Add default Browser text box
- connectTab.add(browserLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
+ connectTab.add(browserLabel, new GridBagConstraints(0, 0, 1, 1, 0.0,
0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
- new Insets(10, 0, 0, 0), 5, 1));
+ new Insets(10, 0, 5, 5), 5, 1));
+ defaultBrowser.setFont(LABEL_FONT);
+ defaultBrowser.setText("");
- connectTab.add(defaultBrowser, new GridBagConstraints(1, 1, 1, 1, 1.0,
- 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(10, 0, 0, 10), 307, 1));
+ connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
+ 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+ new Insets(10, 0, 5, 10), 30, 1));
// Add proxy server panel
- connectTab.add(proxyPanel, new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0,
+ connectTab.add(proxyPanel, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0,
GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
- new Insets(10, 0, 0, 12), 4, 10));
+ new Insets(10, 0, 5, 12), 4, 10));
// Add usage stats, version check and questionnaire checkboxes
- connectTab.add(usagestats, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,
+ connectTab.add(usagestats, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 4, 2), 70, 1));
- connectTab.add(questionnaire, new GridBagConstraints(1, 3, 1, 1, 1.0,
+ new Insets(0, 2, 5, 5), 70, 1));
+ connectTab.add(questionnaire, new GridBagConstraints(1, 2, 1, 1, 1.0,
0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 4, 10), 70, 1));
- connectTab.add(versioncheck, new GridBagConstraints(0, 4, 1, 1, 1.0,
+ new Insets(0, 2, 5, 10), 70, 1));
+ connectTab.add(versioncheck, new GridBagConstraints(0, 3, 1, 1, 1.0,
0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 4, 2), 70, 1));
- return connectTab;
- }
-
- /**
- * Initialises the proxy server panel in the Connections tab
- *
- * @return the proxy server panel
- */
- private JPanel initConnTabProxyPanel()
- {
- // Label for server text box
- serverLabel.setText(MessageManager.getString("label.address"));
- serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- serverLabel.setFont(LABEL_FONT);
-
- // Proxy server and port text boxes
- proxyServerTB.setFont(LABEL_FONT);
- proxyPortTB.setFont(LABEL_FONT);
-
- // Label for Port text box
- portLabel.setFont(LABEL_FONT);
- portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
- portLabel.setText(MessageManager.getString("label.port"));
+ new Insets(0, 2, 5, 5), 70, 1));
- // Use proxy server checkbox
- useProxy.setFont(LABEL_FONT);
- useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
- useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
- useProxy.setText(MessageManager.getString("label.use_proxy_server"));
- useProxy.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- useProxy_actionPerformed();
- }
- });
+ // Add padding so the panel doesn't look ridiculous
+ JPanel spacePanel = new JPanel();
+ connectTab.add(spacePanel, new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0,
+ GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0,
+ 0, 0, 5), 70, 1));
- // Make proxy server panel
- JPanel proxyPanel = new JPanel();
- TitledBorder titledBorder1 = new TitledBorder(
- MessageManager.getString("label.proxy_server"));
- proxyPanel.setBorder(titledBorder1);
- proxyPanel.setLayout(new GridBagLayout());
- proxyPanel.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
- 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
- new Insets(0, 2, 2, 0), 5, 0));
- proxyPanel.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
- GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
- 0, 2, 0), 11, 0));
- proxyPanel.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
- GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
- 2, 5, 185), 2, -4));
- proxyPanel.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0,
- 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 2, 2), 54, 1));
- proxyPanel.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0,
- 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
- new Insets(0, 2, 2, 0), 263, 1));
-
- return proxyPanel;
- }
-
- /**
- * Initialises the checkboxes in the Connections tab
- */
- private void initConnTabCheckboxes()
- {
- // Usage stats checkbox label
- usagestats.setText(MessageManager
- .getString("label.send_usage_statistics"));
- usagestats.setFont(LABEL_FONT);
- usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
- usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
-
- // Questionnaire checkbox label
- questionnaire.setText(MessageManager
- .getString("label.check_for_questionnaires"));
- questionnaire.setFont(LABEL_FONT);
- questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
- questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
-
- // Check for latest version checkbox label
- versioncheck.setText(MessageManager
- .getString("label.check_for_latest_version"));
- versioncheck.setFont(LABEL_FONT);
- versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
- versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
+ return connectTab;
}
/**
- * Initialises the URL links panel in the Connection tab
+ * Initialises the Links tabbed panel.
*
- * @return the URL links panel
+ * @return
*/
- private JPanel initConnTabUrlLinks()
+ private JPanel initLinksTab()
{
+ JPanel linkTab = new JPanel();
+ linkTab.setLayout(new GridBagLayout());
+
// Set up table for Url links
linkUrlTable.setFillsViewportHeight(true);
linkUrlTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
// Put the Url links panel together
// Buttons go at top right, resizing only resizes the blank space vertically
- JPanel buttonPanel = initConnTabUrlButtons();
+ JPanel buttonPanel = initLinkTabUrlButtons();
GridBagConstraints linkConstraints1 = new GridBagConstraints();
- linkConstraints1.gridx = 1;
+ linkConstraints1.insets = new Insets(0, 0, 5, 0);
+ linkConstraints1.gridx = 0;
linkConstraints1.gridy = 0;
- linkConstraints1.fill = GridBagConstraints.VERTICAL;
- linkPanel.add(buttonPanel, linkConstraints1);
+ linkConstraints1.weightx = 1.0;
+ linkConstraints1.fill = GridBagConstraints.HORIZONTAL;
+ linkTab.add(buttonPanel, linkConstraints1);
// Links table goes at top left, resizing resizes the table
GridBagConstraints linkConstraints2 = new GridBagConstraints();
+ linkConstraints2.insets = new Insets(0, 0, 5, 5);
linkConstraints2.gridx = 0;
- linkConstraints2.gridy = 0;
+ linkConstraints2.gridy = 1;
linkConstraints2.weightx = 1.0;
linkConstraints2.weighty = 1.0;
linkConstraints2.fill = GridBagConstraints.BOTH;
- linkPanel.add(linkScrollPane, linkConstraints2);
+ linkTab.add(linkScrollPane, linkConstraints2);
// Filter box and buttons goes at bottom left, resizing resizes the text box
- JPanel filterPanel = initConnTabFilterPanel();
+ JPanel filterPanel = initLinkTabFilterPanel();
GridBagConstraints linkConstraints3 = new GridBagConstraints();
+ linkConstraints3.insets = new Insets(0, 0, 0, 5);
linkConstraints3.gridx = 0;
- linkConstraints3.gridy = 1;
+ linkConstraints3.gridy = 2;
linkConstraints3.weightx = 1.0;
linkConstraints3.fill = GridBagConstraints.HORIZONTAL;
- linkPanel.add(filterPanel, linkConstraints3);
+ linkTab.add(filterPanel, linkConstraints3);
- return linkPanel;
+ return linkTab;
}
- private JPanel initConnTabFilterPanel()
+ private JPanel initLinkTabFilterPanel()
{
// Filter textbox and reset button
JLabel filterLabel = new JLabel(
// Panel for filter functionality
JPanel filterPanel = new JPanel(new GridBagLayout());
+ filterPanel.setBorder(new TitledBorder("Filter"));
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
filterPanel.add(filterLabel, gbc);
GridBagConstraints gbc1 = new GridBagConstraints();
- gbc1.gridx = 0;
gbc1.gridx = 1;
+ gbc1.gridwidth = 2;
gbc1.fill = GridBagConstraints.HORIZONTAL;
gbc1.anchor = GridBagConstraints.WEST;
gbc1.weightx = 1.0;
filterPanel.add(filterTB, gbc1);
GridBagConstraints gbc2 = new GridBagConstraints();
- gbc2.gridx = 2;
+ gbc2.gridx = 3;
gbc2.fill = GridBagConstraints.NONE;
gbc2.anchor = GridBagConstraints.WEST;
filterPanel.add(doReset, gbc2);
GridBagConstraints gbc3 = new GridBagConstraints();
- gbc3.gridx = 3;
+ gbc3.gridx = 4;
gbc3.fill = GridBagConstraints.NONE;
gbc3.anchor = GridBagConstraints.WEST;
filterPanel.add(userOnly, gbc3);
return filterPanel;
}
- private JPanel initConnTabUrlButtons()
+ private JPanel initLinkTabUrlButtons()
{
// Buttons for new / edit / delete Url links
JButton newLink = new JButton();
newLink.setText(MessageManager.getString("action.new"));
+
+ editLink.setText(MessageManager.getString("action.edit"));
+
+ deleteLink.setText(MessageManager.getString("action.delete"));
+
+ // no current selection, so initially disable delete/edit buttons
+ editLink.setEnabled(false);
+ deleteLink.setEnabled(false);
+
newLink.addActionListener(new java.awt.event.ActionListener()
{
@Override
}
});
- // no current selection, so initially disable delete/edit buttons
- editLink.setEnabled(false);
- deleteLink.setEnabled(false);
+ JPanel buttonPanel = new JPanel(new GridBagLayout());
+ buttonPanel.setBorder(new TitledBorder("Edit links"));
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 0;
+ gbc.gridy = 0;
+ gbc.fill = GridBagConstraints.NONE;
+ buttonPanel.add(newLink, gbc);
+
+ GridBagConstraints gbc1 = new GridBagConstraints();
+ gbc1.gridx = 1;
+ gbc1.gridy = 0;
+ gbc1.fill = GridBagConstraints.NONE;
+ buttonPanel.add(editLink, gbc1);
- // Panels for new/edit/delete link buttons
- // buttonContent prevents the buttons from being resized when the window is
- JPanel buttonContent = new JPanel(new GridLayout(0, 1, 0, 0));
- JPanel buttonPanel = new JPanel(new BorderLayout());
+ GridBagConstraints gbc2 = new GridBagConstraints();
+ gbc2.gridx = 2;
+ gbc2.gridy = 0;
+ gbc2.fill = GridBagConstraints.NONE;
+ buttonPanel.add(deleteLink, gbc2);
- buttonContent.add(newLink, null);
- buttonContent.add(editLink, null);
- buttonContent.add(deleteLink, null);
- buttonPanel.add(buttonContent, BorderLayout.NORTH);
+ GridBagConstraints gbc3 = new GridBagConstraints();
+ gbc3.gridx = 3;
+ gbc3.gridy = 0;
+ gbc3.fill = GridBagConstraints.HORIZONTAL;
+ gbc3.weightx = 1.0;
+ JPanel spacePanel = new JPanel();
+ spacePanel.setBorder(null);
+ buttonPanel.add(spacePanel, gbc3);
return buttonPanel;
}
/**
+ * Initialises the proxy server panel in the Connections tab
+ *
+ * @return the proxy server panel
+ */
+ private JPanel initConnTabProxyPanel()
+ {
+ // Label for server text box
+ serverLabel.setText(MessageManager.getString("label.address"));
+ serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ serverLabel.setFont(LABEL_FONT);
+
+ // Proxy server and port text boxes
+ proxyServerTB.setFont(LABEL_FONT);
+ proxyPortTB.setFont(LABEL_FONT);
+
+ // Label for Port text box
+ portLabel.setFont(LABEL_FONT);
+ portLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ portLabel.setText(MessageManager.getString("label.port"));
+
+ // Use proxy server checkbox
+ useProxy.setFont(LABEL_FONT);
+ useProxy.setHorizontalAlignment(SwingConstants.RIGHT);
+ useProxy.setHorizontalTextPosition(SwingConstants.LEADING);
+ useProxy.setText(MessageManager.getString("label.use_proxy_server"));
+ useProxy.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ useProxy_actionPerformed();
+ }
+ });
+
+ // Make proxy server panel
+ JPanel proxyPanel = new JPanel();
+ TitledBorder titledBorder1 = new TitledBorder(
+ MessageManager.getString("label.proxy_server"));
+ proxyPanel.setBorder(titledBorder1);
+ proxyPanel.setLayout(new GridBagLayout());
+ proxyPanel.add(serverLabel, new GridBagConstraints(0, 1, 1, 1, 0.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
+ new Insets(0, 2, 2, 0), 5, 0));
+ proxyPanel.add(portLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
+ 0, 2, 0), 11, 0));
+ proxyPanel.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0,
+ GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
+ 2, 5, 185), 2, -4));
+ proxyPanel.add(proxyPortTB, new GridBagConstraints(3, 1, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 2, 2, 2), 54, 1));
+ proxyPanel.add(proxyServerTB, new GridBagConstraints(1, 1, 1, 1, 1.0,
+ 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+ new Insets(0, 2, 2, 0), 263, 1));
+
+ return proxyPanel;
+ }
+
+ /**
+ * Initialises the checkboxes in the Connections tab
+ */
+ private void initConnTabCheckboxes()
+ {
+ // Usage stats checkbox label
+ usagestats.setText(MessageManager
+ .getString("label.send_usage_statistics"));
+ usagestats.setFont(LABEL_FONT);
+ usagestats.setHorizontalAlignment(SwingConstants.RIGHT);
+ usagestats.setHorizontalTextPosition(SwingConstants.LEADING);
+
+ // Questionnaire checkbox label
+ questionnaire.setText(MessageManager
+ .getString("label.check_for_questionnaires"));
+ questionnaire.setFont(LABEL_FONT);
+ questionnaire.setHorizontalAlignment(SwingConstants.RIGHT);
+ questionnaire.setHorizontalTextPosition(SwingConstants.LEADING);
+
+ // Check for latest version checkbox label
+ versioncheck.setText(MessageManager
+ .getString("label.check_for_latest_version"));
+ versioncheck.setFont(LABEL_FONT);
+ versioncheck.setHorizontalAlignment(SwingConstants.RIGHT);
+ versioncheck.setHorizontalTextPosition(SwingConstants.LEADING);
+ }
+
+ /**
* Initialises the parent panel which contains the tabbed sections.
*
* @return
@Test(groups = { "Functional" })
public void testDisplayColumnNames()
{
- // 4 column names returned although 5 names internal to UrlLinkDisplay
+ // 5 column names returned although 6 names internal to UrlLinkDisplay
List<String> names = UrlLinkDisplay.getDisplayColumnNames();
- Assert.assertEquals(names.size(), 4);
+ Assert.assertEquals(names.size(), 5);
}
@Test(groups = { "Functional" })
public void getValue()
{
UrlLink link = new UrlLink("Test Url",
- "http://identifiers.org/$DB_ACCESSION$");
+ "http://identifiers.org/$DB_ACCESSION$",
+ "TestName");
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false);
Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.PRIMARY));
Assert.assertEquals(u.getValue(UrlLinkDisplay.ID), "Test");
- Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "Test Url");
+ Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "Test Url");
+ Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME),
+ "TestName");
Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.SELECTED));
Assert.assertEquals(u.getValue(UrlLinkDisplay.URL),
"http://identifiers.org/$DB_ACCESSION$");
// default only editable if link contains $SEQUENCE_ID$
UrlLink link = new UrlLink("Test Url",
- "http://identifiers.org/$DB_ACCESSION$");
+ "http://identifiers.org/$DB_ACCESSION$",
+ "TestName");
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false);
Assert.assertFalse(u.isEditable(UrlLinkDisplay.PRIMARY));
Assert.assertFalse(u.isEditable(UrlLinkDisplay.ID));
Assert.assertFalse(u.isEditable(UrlLinkDisplay.URL));
Assert.assertFalse(u.isEditable(UrlLinkDisplay.NAME));
+ Assert.assertFalse(u.isEditable(UrlLinkDisplay.DATABASE));
UrlLink vlink = new UrlLink("Test Sequence ID Url",
- "http://myurl/$SEQUENCE_ID$");
+ "http://myurl/$SEQUENCE_ID$", "TestName");
UrlLinkDisplay v = new UrlLinkDisplay("Test", vlink, false, false);
Assert.assertTrue(v.isEditable(UrlLinkDisplay.PRIMARY));
Assert.assertFalse(v.isEditable(UrlLinkDisplay.ID));
Assert.assertFalse(v.isEditable(UrlLinkDisplay.URL));
Assert.assertFalse(v.isEditable(UrlLinkDisplay.NAME));
+ Assert.assertFalse(v.isEditable(UrlLinkDisplay.DATABASE));
}
@Test(groups = { "Functional" })
public void testName()
{
UrlLink link = new UrlLink("Test Url",
- "http://identifiers.org/$DB_ACCESSION$");
+ "http://identifiers.org/$DB_ACCESSION$",
+ "TestName");
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false);
// Name initially as input in link
}
@Test(groups = { "Functional" })
+ public void testDescription()
+ {
+ UrlLink link = new UrlLink("Test Url",
+ "http://identifiers.org/$DB_ACCESSION$",
+ "TestName");
+ UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false);
+
+ // Desc initially as input in link
+ Assert.assertEquals(u.getDBName(), "TestName");
+
+ // Setting updates name
+ u.setDescription("New Desc");
+ Assert.assertEquals(u.getDBName(), "New Desc");
+ }
+
+ @Test(groups = { "Functional" })
public void testUrl()
{
UrlLink link = new UrlLink("Test Url",
- "http://identifiers.org/$DB_ACCESSION$");
+ "http://identifiers.org/$DB_ACCESSION$",
+ "TestName");
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false);
// Url initially as input in link
public void testGetSetValue()
{
UrlLink link = new UrlLink("Test Url",
- "http://identifiers.org/$DB_ACCESSION$");
+ "http://identifiers.org/$DB_ACCESSION$",
+ "TestName");
UrlLinkDisplay u = new UrlLinkDisplay("Test", link, false, false);
Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.PRIMARY));
Assert.assertFalse((boolean) u.getValue(UrlLinkDisplay.SELECTED));
- Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "Test Url");
+ Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "Test Url");
+ Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME),
+ "TestName");
Assert.assertEquals(u.getValue(UrlLinkDisplay.ID), "Test");
Assert.assertEquals(u.getValue(UrlLinkDisplay.URL),
"http://identifiers.org/$DB_ACCESSION$");
u.setValue(UrlLinkDisplay.SELECTED, true);
Assert.assertTrue((boolean) u.getValue(UrlLinkDisplay.SELECTED));
- u.setValue(UrlLinkDisplay.NAME, "New Name");
- Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "New Name");
+ u.setValue(UrlLinkDisplay.NAME, "New Desc");
+ Assert.assertEquals(u.getValue(UrlLinkDisplay.NAME), "New Desc");
+
+ u.setValue(UrlLinkDisplay.DATABASE, "New Name");
+ Assert.assertEquals(u.getValue(UrlLinkDisplay.DATABASE), "New Name");
u.setValue(UrlLinkDisplay.ID, "New ID");
Assert.assertEquals(u.getValue(UrlLinkDisplay.ID), "New ID");