| | |
| | | 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.server.progressTrack.model.DjJdgzNetworkLevel1; |
| | | import com.example.server.progressTrack.model.DjJdgzShip; |
| | |
| | | private List<ColumnDto> columnDto; |
| | | |
| | | public JPanel createTable(Integer width, Integer height, JFrame jFrame) { |
| | | JPanel panel = new JPanel(); |
| | | JPanel panel = new JPanel(new BorderLayout()); |
| | | |
| | | JPanel topJpanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| | | topJpanel.setPreferredSize(new Dimension(width, 37)); |
| | | topJpanel.setPreferredSize(new Dimension(width, 40)); |
| | | topJpanel.setBackground(Color.WHITE); |
| | | JPanel centerJpanel = new JPanel(); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100)); |
| | | |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(40,jFrame))); |
| | | centerJpanel.setBackground(Color.WHITE); |
| | | panel.add(topJpanel, BorderLayout.NORTH); |
| | | panel.add(centerJpanel, BorderLayout.CENTER); |
| | |
| | | |
| | | table = CommonTable.createCommonTable(list, columnDto); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | final Boolean[] isFirstLoadData = {true}; |
| | |
| | | if (!isFirstLoadData[0]) { |
| | | CommonTable.refreshTable(list, columnDto,table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | tableModelListener(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 - 100)); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(40,jFrame))); |
| | | centerJpanel.add(scrollPane); |
| | | jFrame.addComponentListener(new ComponentAdapter() { |
| | | @Override |
| | | public void componentResized(ComponentEvent e) { |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, Compute.ComputeHeight(40,jFrame))); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20,Compute.ComputeHeightWithScroll(40,jFrame))); |
| | | centerJpanel.revalidate(); |
| | | centerJpanel.repaint(); |
| | | scrollPane.revalidate(); |
| | | scrollPane.repaint(); |
| | | } |
| | | }); |
| | | |
| | | return panel; |
| | | } |
| | |
| | | frame1.setLayout(layout); |
| | | JComboBoxItem[] shipList = djJdgzShipService.getListByItem(); |
| | | JComboBoxItem[] levelList = { |
| | | new JComboBoxItem(1, "一级"), |
| | | new JComboBoxItem(2, "二级"), |
| | | new JComboBoxItem(3, "三级"), |
| | | new JComboBoxItem(1L, "一级"), |
| | | new JComboBoxItem(1L, "二级"), |
| | | new JComboBoxItem(1L, "三级"), |
| | | }; |
| | | |
| | | JLabel JLabel1 = new JLabel("玄号"); |
| | |
| | | data.setStartDate(sdFormat.format(beginDate.getDate())); |
| | | data.setYear((Integer) yearPicker.getValue()); |
| | | data.setAdventDay(7); |
| | | data.setProjectName(ship.getName()+"-"+yearPicker.getValue() + "-" + level.getName()); |
| | | data.setProjectName(level.getName()+"修理"+ship.getName()+"项目"); |
| | | level1Service.insert(data); |
| | | list = level1Service.getList(ship.getId()); |
| | | CommonTable.refreshTable(list,columnDto,table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(table,jFrame); |
| | | frame1.dispose(); |