| | |
| | | public class TeamGroupManageService { |
| | | @Autowired |
| | | private SysTeamGroupClassService sysTeamGroupClassService; |
| | | @Autowired |
| | | private TeamGroupAddOrUpdate addOrUpdate; |
| | | |
| | | private JTable table; |
| | | private List<ColumnDto> columnDto; |
| | |
| | | |
| | | table = CommonTable.createCommonTable(list, columnDto); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | //tableModelListener(table,jFrame,list); |
| | | tableModelListener(table,jFrame,list); |
| | | |
| | | /* btnInsert.addActionListener(new ActionListener() { |
| | | btnInsert.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | SysUser data = new SysUser(); |
| | | addOrUpdate.openDialog(data,jFrame, columnDto,table); |
| | | jFrame.setEnabled(false); |
| | | SysTeamGroupClass data = new SysTeamGroupClass(); |
| | | addOrUpdate.openDialog(data,jFrame, columnDto,table); |
| | | } |
| | | });*/ |
| | | }); |
| | | |
| | | JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | scrollPane.setViewportView(table); |
| | |
| | | return panel; |
| | | } |
| | | |
| | | /* public void tableModelListener(JTable table,JFrame jFrame,List<SysUser> list){ |
| | | public void tableModelListener(JTable table,JFrame jFrame,List<SysTeamGroupClass> list){ |
| | | table.getModel().addTableModelListener(e -> { |
| | | // 检查事件类型 |
| | | if (e.getType() == TableModelEvent.UPDATE) { |
| | |
| | | Object newValue = table.getModel().getValueAt(row, column); |
| | | // 输出变化信息 |
| | | if (newValue.equals("edit")){ |
| | | SysUser data = list.get(row); |
| | | addOrUpdate.openDialog(data,jFrame, columnDto,table); |
| | | jFrame.setEnabled(false); |
| | | SysTeamGroupClass data = list.get(row); |
| | | addOrUpdate.openDialog(data,jFrame, columnDto,table); |
| | | }else if(newValue.equals("del")) { |
| | | int n = JOptionPane.showConfirmDialog(null, "是否删除?", "提示", JOptionPane.YES_NO_OPTION); |
| | | if (n == 0) { |
| | | DefaultTableModel model = (DefaultTableModel) table.getModel(); |
| | | SysUser data = list.get(row); |
| | | userService.deleteLogic(data.getId()); |
| | | SysTeamGroupClass data = list.get(row); |
| | | sysTeamGroupClassService.deleteLogic(data.getId()); |
| | | list.remove(row); |
| | | model.removeRow(row); |
| | | } |
| | |
| | | } |
| | | }); |
| | | } |
| | | */ |
| | | |
| | | } |
| | | |