Skip to content

Commit 8e1070d

Browse files
convert FailuresTableModel to Java, removing Xtend dependencies
1 parent 475e52e commit 8e1070d

File tree

1 file changed

+66
-65
lines changed

1 file changed

+66
-65
lines changed
Lines changed: 66 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Copyright 2019 Philipp Salvisberg <philipp.salvisberg@trivadis.com>
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,78 +15,79 @@
1515
*/
1616
package org.utplsql.sqldev.ui.runner;
1717

18-
import java.util.Collections;
18+
import java.util.Arrays;
1919
import java.util.List;
20+
2021
import javax.swing.table.DefaultTableModel;
21-
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
22+
2223
import org.utplsql.sqldev.model.runner.Expectation;
2324
import org.utplsql.sqldev.resources.UtplsqlResources;
2425

25-
@SuppressWarnings("all")
2626
public class FailuresTableModel extends DefaultTableModel {
27-
private List<Expectation> failedExpectations;
28-
29-
public FailuresTableModel() {
30-
super();
31-
}
32-
33-
public List<Expectation> setModel(final List<Expectation> failedExpectations) {
34-
return this.failedExpectations = failedExpectations;
35-
}
36-
37-
public Expectation getExpectation(final int row) {
38-
return this.failedExpectations.get(row);
39-
}
40-
41-
@Override
42-
public int getRowCount() {
43-
if ((this.failedExpectations == null)) {
44-
return 0;
27+
private static final long serialVersionUID = 8119453059788497567L;
28+
private List<Expectation> failedExpectations;
29+
private List<String> columnNames = Arrays.asList("#", UtplsqlResources.getString("RUNNER_ASSERT_DESCRIPTION_COLUMN"));
30+
31+
public FailuresTableModel() {
32+
super();
33+
}
34+
35+
public void setModel(final List<Expectation> failedExpectations) {
36+
this.failedExpectations = failedExpectations;
37+
}
38+
39+
public Expectation getExpectation(final int row) {
40+
return failedExpectations.get(row);
41+
}
42+
43+
@Override
44+
public int getRowCount() {
45+
if (failedExpectations == null) {
46+
return 0;
47+
}
48+
return failedExpectations.size();
49+
}
50+
51+
@Override
52+
public int getColumnCount() {
53+
return 2;
54+
}
55+
56+
@Override
57+
public Object getValueAt(final int row, final int col) {
58+
final Expectation expectation = failedExpectations.get(row);
59+
if (expectation == null) {
60+
return null;
61+
}
62+
switch (col) {
63+
case 0:
64+
return row + 1;
65+
case 1:
66+
return expectation.getShortFailureText();
67+
default:
68+
return null;
69+
}
4570
}
46-
return this.failedExpectations.size();
47-
}
48-
49-
@Override
50-
public int getColumnCount() {
51-
return 2;
52-
}
53-
54-
@Override
55-
public Object getValueAt(final int row, final int col) {
56-
final Expectation expectation = this.failedExpectations.get(row);
57-
if ((expectation == null)) {
58-
return null;
71+
72+
@Override
73+
public String getColumnName(final int col) {
74+
return columnNames.get(col);
5975
}
60-
switch (col) {
61-
case 0:
62-
return Integer.valueOf((row + 1));
63-
case 1:
64-
return expectation.getShortFailureText();
65-
default:
66-
return null;
76+
77+
@Override
78+
public boolean isCellEditable(final int row, final int column) {
79+
return false;
6780
}
68-
}
69-
70-
@Override
71-
public String getColumnName(final int col) {
72-
String _string = UtplsqlResources.getString("RUNNER_ASSERT_DESCRIPTION_COLUMN");
73-
return Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("#", _string)).get(col);
74-
}
75-
76-
@Override
77-
public boolean isCellEditable(final int row, final int column) {
78-
return false;
79-
}
80-
81-
@Override
82-
public Class<?> getColumnClass(final int col) {
83-
switch (col) {
84-
case 0:
85-
return Integer.class;
86-
case 1:
87-
return String.class;
88-
default:
89-
return String.class;
81+
82+
@Override
83+
public Class<?> getColumnClass(final int col) {
84+
switch (col) {
85+
case 0:
86+
return Integer.class;
87+
case 1:
88+
return String.class;
89+
default:
90+
return String.class;
91+
}
9092
}
91-
}
9293
}

0 commit comments

Comments
 (0)