X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FDasSourceBrowser.java;h=8570ac38dc44f1f015ab660042380a98c16561f7;hb=bd894ca9f2aae448653d7431ab8a170e1105e85c;hp=c0fefd1df7be7227b55a7cb3a04dd44a8a7d85df;hpb=17e77c3f2949a0729322b4a8d907f3f34b6a9914;p=jalview.git
diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java
index c0fefd1..8570ac3 100644
--- a/src/jalview/gui/DasSourceBrowser.java
+++ b/src/jalview/gui/DasSourceBrowser.java
@@ -1,6 +1,6 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
- * Copyright (C) 2015 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
@@ -52,8 +52,8 @@ import org.biodas.jdas.schema.sources.COORDINATES;
import org.biodas.jdas.schema.sources.PROP;
import org.biodas.jdas.schema.sources.VERSION;
-public class DasSourceBrowser extends GDasSourceBrowser implements
- Runnable, ListSelectionListener
+public class DasSourceBrowser extends GDasSourceBrowser
+ implements Runnable, ListSelectionListener
{
DasSourceRegistryI sourceRegistry = null;
@@ -81,6 +81,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
ListSelectionModel rowSM = table.getSelectionModel();
rowSM.addListSelectionListener(new ListSelectionListener()
{
+ @Override
public void valueChanged(ListSelectionEvent e)
{
ListSelectionModel lsm = (ListSelectionModel) e.getSource();
@@ -94,10 +95,10 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
table.addMouseListener(new MouseAdapter()
{
+ @Override
public void mouseClicked(MouseEvent evt)
{
- if (evt.getClickCount() == 2
- || SwingUtilities.isRightMouseButton(evt))
+ if (evt.getClickCount() == 2 || evt.isPopupTrigger())
{
editRemoveLocalSource(evt);
}
@@ -119,6 +120,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
this(null);
}
+ @Override
public void paintComponent(java.awt.Graphics g)
{
if (sourceRegistry == null)
@@ -136,8 +138,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
for (int i = 0; i < dSize; i++)
{
data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname
- data[i][1] = new Boolean(selectedSources.contains(sources.get(i)
- .getTitle()));
+ data[i][1] = new Boolean(
+ selectedSources.contains(sources.get(i).getTitle()));
}
refreshTableData(data);
@@ -145,6 +147,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
TableSorter sorter = (TableSorter) table.getModel();
@@ -174,9 +177,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
if (nickName == null)
{
- fullDetails.setText(text
- + MessageManager
- .getString("label.select_das_service_from_table"));
+ fullDetails.setText(text + MessageManager
+ .getString("label.select_das_service_from_table"));
return;
}
@@ -189,8 +191,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
}
VERSION latest = ds.getVersion();
- text.append("Id: " + ds.getUri()
- + "
");
+ text.append(
+ "Id: " + ds.getUri() + "
");
text.append("Nickname: "
+ ds.getTitle() + "
");
@@ -209,8 +211,10 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
text.append("Description: "
+ ds.getDescription() + "
");
- text.append("Admin Email: " + ds.getEmail() + "" + "
");
+ text.append(
+ "Admin Email: " + ds.getEmail() + ""
+ + "
");
text.append("Registered at: "
+ latest.getCreated() + "
");
@@ -282,6 +286,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
fullDetails.setText(text.toString());
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
fullDetailsScrollpane.getVerticalScrollBar().setValue(0);
@@ -289,6 +294,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
});
}
+ @Override
public void run()
{
loadingDasSources = true;
@@ -358,6 +364,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
return selected;
}
+ @Override
public void refresh_actionPerformed(ActionEvent e)
{
saveProperties(jalview.bin.Cache.applicationProperties);
@@ -411,6 +418,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
filter1.setSelectedIndex(0);
@@ -420,6 +428,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
});
}
+ @Override
public void amendLocal(boolean newSource)
{
String url = "http://localhost:8080/", nickname = "";
@@ -440,23 +449,22 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
seqs.setSelected(seqsrc);
JPanel panel = new JPanel(new BorderLayout());
JPanel pane12 = new JPanel(new BorderLayout());
- pane12.add(new JLabel(MessageManager.getString("label.name")),
+ pane12.add(new JLabel(MessageManager.getString("label.name:")),
BorderLayout.CENTER);
pane12.add(nametf, BorderLayout.EAST);
panel.add(pane12, BorderLayout.NORTH);
pane12 = new JPanel(new BorderLayout());
- pane12.add(new JLabel(MessageManager.getString("label.url")),
+ pane12.add(new JLabel(MessageManager.getString("label.url:")),
BorderLayout.NORTH);
pane12.add(seqs, BorderLayout.SOUTH);
pane12.add(urltf, BorderLayout.EAST);
panel.add(pane12, BorderLayout.SOUTH);
- int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- panel,
- MessageManager.getString("label.enter_local_das_source"),
- JOptionPane.OK_CANCEL_OPTION);
+ int reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ panel, MessageManager.getString("label.enter_local_das_source"),
+ JvOptionPane.OK_CANCEL_OPTION);
- if (reply != JOptionPane.OK_OPTION)
+ if (reply != JvOptionPane.OK_OPTION)
{
return;
}
@@ -466,19 +474,21 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
urltf.setText(urltf.getText() + "/");
}
- jalviewSourceI local = sourceRegistry.createLocalSource(
- urltf.getText(), nametf.getText(), seqs.isSelected(), true);
+ jalviewSourceI local = sourceRegistry.createLocalSource(urltf.getText(),
+ nametf.getText(), seqs.isSelected(), true);
List sources = sourceRegistry.getSources();
int osize = sources.size();
int size = osize + (newSource ? 1 : 0);
Object[][] data = new Object[size][2];
- DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table
- .getModel()).getTableModel() : null;
+ DASTableModel dtm = (table != null)
+ ? (DASTableModel) ((TableSorter) table.getModel())
+ .getTableModel()
+ : null;
for (int i = 0; i < osize; i++)
{
- String osrc = (dtm == null || i >= osize) ? null : (String) dtm
- .getValueAt(i, 0);
+ String osrc = (dtm == null || i >= osize) ? null
+ : (String) dtm.getValueAt(i, 0);
if (!newSource && osrc != null
&& dtm.getValueAt(i, 0).equals(nickname))
{
@@ -503,10 +513,11 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
- scrollPane.getVerticalScrollBar().setValue(
- scrollPane.getVerticalScrollBar().getMaximum());
+ scrollPane.getVerticalScrollBar()
+ .setValue(scrollPane.getVerticalScrollBar().getMaximum());
}
});
@@ -525,22 +536,20 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
if (!sourceRegistry.getSource(nickname).isLocal())
{
- JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
- MessageManager
- .getString("label.you_can_only_edit_or_remove_local_das_sources"),
- MessageManager.getString("label.public_das_source"),
- JOptionPane.WARNING_MESSAGE);
+ JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.getString(
+ "label.you_can_only_edit_or_remove_local_das_sources"),
+ MessageManager.getString("label.public_das_source"),
+ JvOptionPane.WARNING_MESSAGE);
return;
}
Object[] options = { "Edit", "Remove", "Cancel" };
- int choice = JOptionPane.showInternalOptionDialog(Desktop.desktop,
+ int choice = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
"Do you want to edit or remove " + nickname + "?",
"Edit / Remove Local DAS Source",
- JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
- null, options, options[2]);
+ JvOptionPane.YES_NO_CANCEL_OPTION,
+ JvOptionPane.QUESTION_MESSAGE, null, options, options[2]);
switch (choice)
{
@@ -551,8 +560,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname));
selectedSources.remove(nickname);
Object[][] data = new Object[sourceRegistry.getSources().size()][2];
- int index = 0,
- l = table.getRowCount();
+ int index = 0, l = table.getRowCount();
for (int i = 0; i < l; i++)
{
@@ -571,10 +579,11 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
refreshTableData(data);
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
- scrollPane.getVerticalScrollBar().setValue(
- scrollPane.getVerticalScrollBar().getMaximum());
+ scrollPane.getVerticalScrollBar()
+ .setValue(scrollPane.getVerticalScrollBar().getMaximum());
}
});
@@ -582,6 +591,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
}
}
+ @Override
public void valueChanged(ListSelectionEvent evt)
{
// Called when the MainTable selection changes
@@ -607,11 +617,10 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
VERSION v = ds.getVersion();
List coords = v.getCOORDINATES();
- if (ds.isLocal()
- || ((coords == null || coords.size() == 0)
- && filter1.getSelectedIndex() == 0
- && filter2.getSelectedIndex() == 0 && filter3
- .getSelectedIndex() == 0))
+ if (ds.isLocal() || ((coords == null || coords.size() == 0)
+ && filter1.getSelectedIndex() == 0
+ && filter2.getSelectedIndex() == 0
+ && filter3.getSelectedIndex() == 0))
{
// THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT
// HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT
@@ -631,12 +640,14 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
for (int j = 0; j < coords.size(); j++)
{
if (selectedInList(filter1.getSelectedValues(),
- new String[] { coords.get(j).getAuthority() })
+ new String[]
+ { coords.get(j).getAuthority() })
&& selectedInList(filter2.getSelectedValues(), new String[]
{ coords.get(j).getSource() }))
{
names.add(ds.getTitle());
- selected.add(new Boolean(selectedSources.contains(ds.getTitle())));
+ selected.add(
+ new Boolean(selectedSources.contains(ds.getTitle())));
break;
}
}
@@ -691,6 +702,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
}
}
+ @Override
public void reset_actionPerformed(ActionEvent e)
{
registryURL.setText(sourceRegistry.getDasRegistryURL());
@@ -743,21 +755,25 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
private Object[][] data;
+ @Override
public int getColumnCount()
{
return columnNames.length;
}
+ @Override
public int getRowCount()
{
return data.length;
}
+ @Override
public String getColumnName(int col)
{
return columnNames[col];
}
+ @Override
public Object getValueAt(int row, int col)
{
return data[row][col];
@@ -768,6 +784,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
* each cell. If we didn't implement this method, then the last column would
* contain text ("true"/"false"), rather than a check box.
*/
+ @Override
public Class getColumnClass(int c)
{
return getValueAt(0, c).getClass();
@@ -776,6 +793,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
/*
* Don't need to implement this method unless your table's editable.
*/
+ @Override
public boolean isCellEditable(int row, int col)
{
// Note that the data/cell address is constant,
@@ -787,6 +805,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
/*
* Don't need to implement this method unless your table's data can change.
*/
+ @Override
public void setValueAt(Object value, int row, int col)
{
data[row][col] = value;
@@ -812,6 +831,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
Thread thr = new Thread(new Runnable()
{
+ @Override
public void run()
{
// this actually initialises the das source list