X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDasSourceBrowser.java;h=8c8f228a745e0e8dc65ac9f23f6abf3cffb3d736;hb=fee1b781ca14aadea5d112fc554fe14879c787c5;hp=3efde6a47c36fc288ca857e220a81f402bfb2318;hpb=59d682209891099d46b960509907c79e3fb276fe;p=jalview.git diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java old mode 100755 new mode 100644 index 3efde6a..8c8f228 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -1,23 +1,27 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) - * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.gui; import jalview.jbgui.GDasSourceBrowser; +import jalview.util.MessageManager; import jalview.util.TableSorter; import jalview.ws.dbsources.das.api.DasSourceRegistryI; import jalview.ws.dbsources.das.api.jalviewSourceI; @@ -77,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(); @@ -90,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); } @@ -115,6 +120,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements this(null); } + @Override public void paintComponent(java.awt.Graphics g) { if (sourceRegistry == null) @@ -141,6 +147,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { TableSorter sorter = (TableSorter) table.getModel(); @@ -170,8 +177,9 @@ public class DasSourceBrowser extends GDasSourceBrowser implements if (nickName == null) { - fullDetails.setText(text + "Select a DAS service from the table" - + " to read a full description here."); + fullDetails.setText(text + + MessageManager + .getString("label.select_das_service_from_table")); return; } @@ -277,6 +285,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); @@ -284,6 +293,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements }); } + @Override public void run() { loadingDasSources = true; @@ -353,6 +363,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements return selected; } + @Override public void refresh_actionPerformed(ActionEvent e) { saveProperties(jalview.bin.Cache.applicationProperties); @@ -406,6 +417,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { filter1.setSelectedIndex(0); @@ -415,6 +427,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements }); } + @Override public void amendLocal(boolean newSource) { String url = "http://localhost:8080/", nickname = ""; @@ -430,24 +443,28 @@ public class DasSourceBrowser extends GDasSourceBrowser implements JTextField nametf = new JTextField(nickname, 40); JTextField urltf = new JTextField(url, 40); - JCheckBox seqs = new JCheckBox("Sequence Source"); + JCheckBox seqs = new JCheckBox( + MessageManager.getString("label.sequence_source")); seqs.setSelected(seqsrc); JPanel panel = new JPanel(new BorderLayout()); JPanel pane12 = new JPanel(new BorderLayout()); - pane12.add(new JLabel("Nickname: "), BorderLayout.CENTER); + 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("URL: "), BorderLayout.NORTH); + 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, "Enter Nickname & URL of 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; } @@ -494,6 +511,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { scrollPane.getVerticalScrollBar().setValue( @@ -516,19 +534,21 @@ public class DasSourceBrowser extends GDasSourceBrowser implements if (!sourceRegistry.getSource(nickname).isLocal()) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - "You can only edit or remove local DAS Sources!", - "Public DAS source - not editable", - 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, + Object[] options = { "Edit", "Remove", "Cancel" }; + 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, + JvOptionPane.YES_NO_CANCEL_OPTION, JvOptionPane.QUESTION_MESSAGE, null, options, options[2]); switch (choice) @@ -560,6 +580,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements refreshTableData(data); SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { scrollPane.getVerticalScrollBar().setValue( @@ -571,6 +592,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements } } + @Override public void valueChanged(ListSelectionEvent evt) { // Called when the MainTable selection changes @@ -589,8 +611,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements // The features filter is not visible, but we must still // filter the das source list here. // July 2006 - only 6 sources fo not serve features - Object[] dummyFeatureList = new Object[] - { "features" }; + Object[] dummyFeatureList = new Object[] { "features" }; List srcs = sourceRegistry.getSources(); for (jalviewSourceI ds : srcs) { @@ -620,8 +641,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements for (int j = 0; j < coords.size(); j++) { - if (selectedInList(filter1.getSelectedValues(), new String[] - { coords.get(j).getAuthority() }) + if (selectedInList(filter1.getSelectedValues(), + new String[] { coords.get(j).getAuthority() }) && selectedInList(filter2.getSelectedValues(), new String[] { coords.get(j).getSource() })) { @@ -681,6 +702,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements } } + @Override public void reset_actionPerformed(ActionEvent e) { registryURL.setText(sourceRegistry.getDasRegistryURL()); @@ -727,26 +749,31 @@ public class DasSourceBrowser extends GDasSourceBrowser implements this.data = data; } - private String[] columnNames = new String[] - { "Nickname", "Use Source" }; + private String[] columnNames = new String[] { + MessageManager.getString("label.nickname"), + MessageManager.getString("label.use_source") }; 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]; @@ -757,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(); @@ -765,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, @@ -776,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; @@ -801,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