esoe
3 years ago
24 changed files with 367 additions and 57 deletions
@ -1,5 +0,0 @@
@@ -1,5 +0,0 @@
|
||||
package ru.egspt; |
||||
|
||||
public class QuizesListModel { |
||||
|
||||
} |
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
package ru.egspt; |
||||
|
||||
import javax.swing.table.AbstractTableModel; |
||||
|
||||
public class QuizesTableModel extends AbstractTableModel{ |
||||
private String[] header = {"id", "name"}; |
||||
private Object[][] data; |
||||
public QuizesTableModel(Data data){ |
||||
setData(data); |
||||
} |
||||
@Override |
||||
public int getRowCount() { |
||||
return getData().length; |
||||
} |
||||
|
||||
@Override |
||||
public int getColumnCount() { |
||||
return getHeader().length; |
||||
} |
||||
|
||||
@Override |
||||
public Object getValueAt(int rowIndex, int columnIndex) { |
||||
return getData()[rowIndex][columnIndex]; |
||||
} |
||||
/** |
||||
* @return the data |
||||
*/ |
||||
public Object[][] getData() { |
||||
return data; |
||||
} |
||||
/** |
||||
* |
||||
*/ |
||||
public void setData(Data data) { |
||||
//создаем объект data - инициализация переменной
|
||||
int row = 0; |
||||
row = data.getQuizes().size(); |
||||
int col = 2;//по количеству заголовков
|
||||
this.data = new Object[row][col]; |
||||
//заполняем модель данными пользователей
|
||||
int i = 0; |
||||
while (i < data.getQuizes().size()){ |
||||
this.data[i][0] = data.getQuizes().get(i).getId(); |
||||
this.data[i][1] = data.getQuizes().get(i).getName(); |
||||
i++; |
||||
this.fireTableDataChanged(); |
||||
} |
||||
} |
||||
/** |
||||
* @return the header |
||||
*/ |
||||
public String[] getHeader() { |
||||
return header; |
||||
} |
||||
/** |
||||
* @param header the header to set |
||||
*/ |
||||
public void setHeader(String[] header) { |
||||
this.header = header; |
||||
} |
||||
|
||||
} |
@ -1,5 +0,0 @@
@@ -1,5 +0,0 @@
|
||||
package ru.egspt; |
||||
|
||||
public class ResultsListModel { |
||||
|
||||
} |
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
package ru.egspt; |
||||
|
||||
import javax.swing.table.AbstractTableModel; |
||||
|
||||
public class ResultsTableModel extends AbstractTableModel{ |
||||
private String[] header = {"id", "Quizid", "Userid", "Grade", "Time"}; |
||||
private Object[][] data; |
||||
public ResultsTableModel(Data data){ |
||||
setData(data); |
||||
} |
||||
@Override |
||||
public int getRowCount() { |
||||
return getData().length; |
||||
} |
||||
|
||||
@Override |
||||
public int getColumnCount() { |
||||
return getHeader().length; |
||||
} |
||||
|
||||
@Override |
||||
public Object getValueAt(int rowIndex, int columnIndex) { |
||||
return getData()[rowIndex][columnIndex]; |
||||
} |
||||
/** |
||||
* @return the data |
||||
*/ |
||||
public Object[][] getData() { |
||||
return data; |
||||
} |
||||
/** |
||||
* |
||||
*/ |
||||
public void setData(Data data) { |
||||
//создаем объект data - инициализация переменной
|
||||
int row = 0; |
||||
row = data.getResults().size(); |
||||
int col = 5;//по количеству заголовков
|
||||
this.data = new Object[row][col]; |
||||
//заполняем модель данными пользователей
|
||||
int i = 0; |
||||
while (i < data.getResults().size()){ |
||||
this.data[i][0] = data.getResults().get(i).getId(); |
||||
this.data[i][1] = data.getResults().get(i).getQuizid(); |
||||
this.data[i][2] = data.getResults().get(i).getUserid(); |
||||
this.data[i][3] = data.getResults().get(i).getGrade(); |
||||
this.data[i][4] = data.getResults().get(i).getTime(); |
||||
i++; |
||||
this.fireTableDataChanged(); |
||||
} |
||||
} |
||||
/** |
||||
* @return the header |
||||
*/ |
||||
public String[] getHeader() { |
||||
return header; |
||||
} |
||||
/** |
||||
* @param header the header to set |
||||
*/ |
||||
public void setHeader(String[] header) { |
||||
this.header = header; |
||||
} |
||||
} |
@ -0,0 +1,63 @@
@@ -0,0 +1,63 @@
|
||||
package ru.egspt; |
||||
|
||||
import javax.swing.table.AbstractTableModel; |
||||
|
||||
public class UsersTableModel extends AbstractTableModel{ |
||||
private Object[] header = new String[]{"id", "login", "mail"}; |
||||
private Object[][] data; |
||||
public UsersTableModel(Data data){ |
||||
setData(data); |
||||
} |
||||
@Override |
||||
public int getRowCount() { |
||||
return getData().length; |
||||
} |
||||
|
||||
@Override |
||||
public int getColumnCount() { |
||||
return getHeader().length; |
||||
} |
||||
|
||||
@Override |
||||
public Object getValueAt(int rowIndex, int columnIndex) { |
||||
return getData()[rowIndex][columnIndex]; |
||||
} |
||||
/** |
||||
* @return the data |
||||
*/ |
||||
public Object[][] getData() { |
||||
return data; |
||||
} |
||||
/** |
||||
* |
||||
*/ |
||||
public void setData(Data data) { |
||||
//создаем объект data - инициализация переменной
|
||||
int row = 0; |
||||
row = data.getUsers().size(); |
||||
int col = 3;//по количеству заголовков
|
||||
this.data = new Object[row][col]; |
||||
//заполняем модель данными пользователей
|
||||
int i = 0; |
||||
while (i < data.getUsers().size()){ |
||||
this.data[i][0] = data.getUsers().get(i).getId(); |
||||
this.data[i][1] = data.getUsers().get(i).getLogin(); |
||||
this.data[i][2] = data.getUsers().get(i).getMail(); |
||||
i++; |
||||
this.fireTableDataChanged(); |
||||
} |
||||
} |
||||
/** |
||||
* @return the header |
||||
*/ |
||||
public Object[] getHeader() { |
||||
return header; |
||||
} |
||||
/** |
||||
* @param header the header to set |
||||
*/ |
||||
public void setHeader(String[] header) { |
||||
this.header = header; |
||||
} |
||||
|
||||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue