Commit 89e0ae9a45e87a5cdba6484ad58e37665c60ed77

Authored by Nathanael Jourdane
1 parent 77184f22
Exists in master

Move JTable listener in ServicesPanel

src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ResultsPanel.java
... ... @@ -34,13 +34,11 @@ public class ResultsPanel extends JPanel {
34 34 private static final long serialVersionUID = -3387526562625069156L;
35 35  
36 36 /** The logger for the class ResultPanel. */
37   - @SuppressWarnings("unused")
38 37 private static final Logger logger = Logger.getLogger(ResultsPanel.class.getName());
39 38  
40 39 @SuppressWarnings("unused")
41 40 private EpnTapMainView mainView;
42 41  
43   - @SuppressWarnings("unused")
44 42 private VOTableView voTableView;
45 43  
46 44 public ResultsPanel(EpnTapMainView mainView, VOTableView voTableView) {
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/view/panels/ServicesPanel.java
... ... @@ -40,7 +40,6 @@ public class ServicesPanel extends JPanel {
40 40 @SuppressWarnings("unused")
41 41 private static final Logger logger = Logger.getLogger(ServicesPanel.class.getName());
42 42  
43   - @SuppressWarnings("unused")
44 43 private EpnTapMainView mainView;
45 44  
46 45 private VOTableView voTableView;
... ... @@ -49,7 +48,6 @@ public class ServicesPanel extends JPanel {
49 48 super();
50 49 this.mainView = mainView;
51 50 this.voTableView = voTableView;
52   -
53 51 this.setLayout(new BorderLayout());
54 52 this.add(voTableView);
55 53  
... ... @@ -57,7 +55,7 @@ public class ServicesPanel extends JPanel {
57 55 setMinimumSize(new Dimension(Dim.LEFT_PANEL_MIN_WIDTH, Dim.TOP_PANEL_MIN_HEIGHT));
58 56  
59 57 // TODO: Support multi-selection
60   - voTableView.getTable().getSelectionModel()
  58 + this.voTableView.getTable().getSelectionModel()
61 59 .addListSelectionListener(new ListSelectionListener() {
62 60 @Override
63 61 public void valueChanged(ListSelectionEvent evt) {
... ... @@ -65,6 +63,7 @@ public class ServicesPanel extends JPanel {
65 63 voTableView.getTable().getSelectedRow());
66 64 }
67 65 });
  66 +
68 67 }
69 68  
70 69 public String getServiceURL(int row) {
... ...
src/main/java/eu/omp/irap/vespa/epntapclient/votable/view/VOTableView.java
... ... @@ -37,17 +37,17 @@ import eu.omp.irap.vespa.epntapclient.votable.Utils;
37 37 */
38 38 public class VOTableView extends JPanel implements TableModelListener {
39 39 /** The logger for the class VOTableView. */
40   - private static final Logger logger = Logger.getLogger(VOTableView.class.getName());
  40 + static final Logger logger = Logger.getLogger(VOTableView.class.getName());
41 41  
42 42 // TODO: Create classes VOTableGUI and VOTableCLI which implements an interface VOTableView
43 43 /** The serial version UID (affected with a random number). */
44 44 private static final long serialVersionUID = -6131752938586134234L;
45 45  
46 46 /** The JTable component where the data are displayed. */
47   - private JTable table;
  47 + JTable table;
48 48  
49 49 /** The DataModel representing the VOTable data in the JTable element. */
50   - DefaultTableModel tableData;
  50 + private DefaultTableModel tableData;
51 51  
52 52 /**
53 53 * Method constructor
... ... @@ -64,6 +64,7 @@ public class VOTableView extends JPanel implements TableModelListener {
64 64 };
65 65  
66 66 table = new JTable(tableData);
  67 +
67 68 JScrollPane scrollPane = new JScrollPane(table);
68 69 scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
69 70 scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
... ... @@ -100,7 +101,6 @@ public class VOTableView extends JPanel implements TableModelListener {
100 101 * content.
101 102 */
102 103 public Object getValueAt(int column, int row) {
103   - Object val = tableData.getValueAt(row, column);
104 104 return tableData.getValueAt(row, column);
105 105 }
106 106  
... ...