| | |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.model.TableButton; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.Compute; |
| | | import com.example.client.utils.GBC; |
| | | import com.example.client.utils.MultiSelectComboBox; |
| | | import com.example.server.cabin.service.CabinService; |
| | |
| | | import com.example.server.progressTrack.model.DjJdgzShip; |
| | | import com.example.server.progressTrack.service.*; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | public JPanel createTable(Integer width, Integer height, JFrame jFrame) { |
| | | JPanel panel = new JPanel(); |
| | | panel.setPreferredSize(new Dimension(width, height)); |
| | | |
| | | JPanel topJpanel = new JPanel(); |
| | | GridBagLayout layout = new GridBagLayout(); |
| | |
| | | topJpanel.setBackground(Color.WHITE); |
| | | |
| | | JPanel centerJpanel = new JPanel(); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100)); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(105, jFrame))); |
| | | centerJpanel.setBackground(Color.WHITE); |
| | | panel.add(topJpanel, BorderLayout.NORTH); |
| | | panel.add(centerJpanel, BorderLayout.CENTER); |
| | |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | | String[] typeList = new String[]{ |
| | | "改装", "加装", "换装", "改进性修理" |
| | | "","改装", "加装", "换装", "修理","改进性修理" |
| | | }; |
| | | |
| | | JLabel JLabel0 = new JLabel("工程"); |
| | |
| | | topJpanel.add(btnInsert, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(btnImport, new GBC(4, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | list = level3Service.getList(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null); |
| | | list = level3Service.getList(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], null); |
| | | List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("edit", "编辑")); |
| | | buttonList.add(new TableButton("del", "删除")); |
| | |
| | | |
| | | columnDto = new ArrayList<>(); |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | columnDto.add(new ColumnDto("序号", "", (width - 10) / 10, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("工程", "ProjectName", (width - 10) / 10, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("部门", "deptId", (width - 10) / 10, "dict", false, null, deptList)); |
| | | columnDto.add(new ColumnDto("专业", "teamgroupId", (width - 10) / 10, "dict", false, null, teamList)); |
| | | columnDto.add(new ColumnDto("舱室", "cabinId", (width - 10) / 10, "dict", false, null, cabinList)); |
| | | columnDto.add(new ColumnDto("类别", "type", (width - 10) / 10, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("一级网络图节点名称", "level1NodeName", (width - 10) / 10, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("二级网络图节点名称", "level2NodeName", (width - 10) / 10, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("三级网络图名称", "name", (width - 10) / 10, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("操作", "", (width - 10) / 10, "", true, buttonList, null)); |
| | | columnDto.add(new ColumnDto("序号", "", 176, "autoCreate", false, null, null)); |
| | | //columnDto.add(new ColumnDto("工程", "ProjectName", 150, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("部门", "deptId", 176, "dict", false, null, deptList)); |
| | | columnDto.add(new ColumnDto("专业", "teamgroupId", 176, "dict", false, null, teamList)); |
| | | columnDto.add(new ColumnDto("舱室", "cabinId", 176, "dict", false, null, cabinList)); |
| | | columnDto.add(new ColumnDto("类别", "type", 176, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("一级网络图节点名称", "level1NodeName", 176, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("二级网络图节点名称", "level2NodeName", 185, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("三级网络图名称", "name", 176, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("操作", "", 190, "", true, buttonList, null)); |
| | | |
| | | table = CommonTable.createCommonTable(list, columnDto); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | for (int i = 0; i < shipList.size(); i++) { |
| | | shipMap.put(shipList.get(i).getShipNo(), shipList.get(i).getId()); |
| | | comboBox.addItem(shipList.get(i).getShipNo()); |
| | | } |
| | | comboBox.setSelectedItem(shipList.get(0).getShipNo()); |
| | | comboBox.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | |
| | | if (e.getStateChange() == ItemEvent.SELECTED) { |
| | | JComboBoxItem selectedItem = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | if (selectedItem != null) { |
| | | long selectedId = selectedItem.getId(); |
| | | Long selectedId = selectedItem.getId(); |
| | | |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(selectedId); |
| | | comboBox2.setModel(new DefaultComboBoxModel<>(teamList)); |
| | | comboBox2.setSelectedIndex(0); |
| | | |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null); |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | tableModelListener(list, table, jFrame); |
| | |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type, null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | |
| | | query.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | list = level3Service.getList(null, null, null, null, null,sb.getText()); |
| | | list = level3Service.getList(null, null, null, null, null, sb.getText()); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | | }); |
| | | |
| | | for (int i = 0; i < shipList.size(); i++) { |
| | | shipMap.put(shipList.get(i).getShipNo(), shipList.get(i).getId()); |
| | | comboBox.addItem(shipList.get(i).getShipNo()); |
| | | } |
| | | comboBox.setSelectedItem(shipList.get(0).getShipNo()); |
| | | |
| | | tableModelListener(list, table, jFrame); |
| | | |
| | | btnInsert.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | jFrame.setEnabled(false); |
| | | insert(jFrame); |
| | | } |
| | | }); |
| | |
| | | btnImport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | jFrame.setEnabled(false); |
| | | importService.FileUpload(columnDto, table, jFrame); |
| | | } |
| | | }); |
| | |
| | | JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | scrollPane.setViewportView(table); |
| | | scrollPane.getViewport().setBackground(Color.WHITE); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, height - 120)); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeightWithScroll(105, jFrame))); |
| | | centerJpanel.add(scrollPane); |
| | | jFrame.addComponentListener(new ComponentAdapter() { |
| | | @Override |
| | | public void componentResized(ComponentEvent e) { |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(105, jFrame))); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeightWithScroll(105, jFrame))); |
| | | centerJpanel.revalidate(); |
| | | centerJpanel.repaint(); |
| | | scrollPane.revalidate(); |
| | | scrollPane.repaint(); |
| | | } |
| | | }); |
| | | |
| | | return panel; |
| | | } |
| | |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); |
| | | String[] typeList = new String[]{ |
| | | "改装", "加装", "换装", "改进性修理" |
| | | "","改装", "加装", "换装", "修理","改进性修理" |
| | | }; |
| | | |
| | | JLabel JLabel1 = new JLabel("工程"); |
| | |
| | | data.setCabinId(String.valueOf(selectedIds)); |
| | | data.setType(comboBox6.getSelectedItem().toString()); |
| | | level3Service.insert(data); |
| | | list = level3Service.getList(level1Data.getShipId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null); |
| | | list = level3Service.getList(level1Data.getShipId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], null); |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | frame1.dispose(); |