esoe
3 years ago
8 changed files with 107 additions and 9 deletions
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
<mxfile host="65bd71144e"> |
||||
<diagram id="ihwz2KHPgUZGItZvBWFA" name="Page-1"> |
||||
<mxGraphModel dx="758" dy="518" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> |
||||
<root> |
||||
<mxCell id="0"/> |
||||
<mxCell id="1" parent="0"/> |
||||
</root> |
||||
</mxGraphModel> |
||||
</diagram> |
||||
</mxfile> |
@ -0,0 +1,82 @@
@@ -0,0 +1,82 @@
|
||||
package ru.egspt.moodle; |
||||
|
||||
import javax.swing.table.TableModel; |
||||
import java.util.HashSet; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
|
||||
import javax.swing.event.TableModelListener; |
||||
|
||||
public class UsersModel implements TableModel{ |
||||
private Set<TableModelListener> listeners = new HashSet<TableModelListener>(); |
||||
private List<User> users; |
||||
|
||||
public UsersModel(List<User> users) { |
||||
this.users = users; |
||||
} |
||||
|
||||
public void addTableModelListener(TableModelListener listener) { |
||||
listeners.add(listener); |
||||
} |
||||
|
||||
|
||||
public Class<?> getColumnClass(int columnIndex) { |
||||
switch (columnIndex) { |
||||
case 0: |
||||
return int.class; |
||||
case 1: |
||||
return String.class; |
||||
case 2: |
||||
return String.class; |
||||
} |
||||
return String.class; |
||||
} |
||||
|
||||
public int getColumnCount() { |
||||
return 3; |
||||
} |
||||
|
||||
public String getColumnName(int columnIndex) { |
||||
switch (columnIndex) { |
||||
case 0: |
||||
return "id"; |
||||
case 1: |
||||
return "name"; |
||||
case 2: |
||||
return "mail"; |
||||
} |
||||
return ""; |
||||
} |
||||
|
||||
public int getRowCount() { |
||||
return users.size(); |
||||
} |
||||
|
||||
public Object getValueAt(int rowIndex, int columnIndex) { |
||||
User user = users.get(rowIndex); |
||||
switch (columnIndex) { |
||||
case 0: |
||||
return user.getId(); |
||||
case 1: |
||||
return user.getName(); |
||||
case 2: |
||||
return user.getMail(); |
||||
} |
||||
return ""; |
||||
} |
||||
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) { |
||||
return false; |
||||
} |
||||
|
||||
public void removeTableModelListener(TableModelListener listener) { |
||||
listeners.remove(listener); |
||||
} |
||||
|
||||
public void setValueAt(Object value, int rowIndex, int columnIndex) { |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue