| | |
| | | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.Compute; |
| | | import com.example.server.progressTrack.Dto.NetworkNodeStatusDto; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel1; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel2; |
| | |
| | | |
| | | import javax.swing.*; |
| | | import java.awt.*; |
| | | import java.awt.event.MouseAdapter; |
| | | import java.awt.event.MouseEvent; |
| | | import java.awt.event.MouseWheelEvent; |
| | | import java.awt.event.MouseWheelListener; |
| | | import java.awt.event.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | @Autowired |
| | | private NetWorkDiagramService netWorkDiagramService; |
| | | |
| | | public JPanel createTable(Integer width, Integer height) { |
| | | height = height - 100; |
| | | JPanel panel = new JPanel(); |
| | | public JPanel createTable(Integer width, Integer height, JFrame frame) { |
| | | JPanel panel = new JPanel(new BorderLayout()); |
| | | panel.setPreferredSize(new Dimension(width, height)); |
| | | |
| | | JPanel jLeft = new JPanel(new BorderLayout()); |
| | | jLeft.setPreferredSize(new Dimension(width / 4 - 20, height)); |
| | | JPanel jLeft = new JPanel(); |
| | | jLeft.setPreferredSize(new Dimension(width / 4 - 20, Compute.ComputeHeight(0, frame))); |
| | | |
| | | JPanel diagram = new JPanel(new BorderLayout()); |
| | | diagram.setPreferredSize(new Dimension(width - width / 4, height)); |
| | |
| | | //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 / 8, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("一级节点", "processName", width / 8, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("序号", "", 120, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("工程", "ProjectName", 145, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("一级节点", "processName", 125, null, false, null, null)); |
| | | |
| | | JTable subTable = CommonTable.createCommonTable(list, columnDto); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | JScrollPane scrollTable = new JScrollPane(subTable); |
| | | jLeft.add(scrollTable, BorderLayout.CENTER); |
| | | scrollTable.setPreferredSize(new Dimension(width / 4 - 20, Compute.ComputeHeightWithScroll(0, frame))); |
| | | jLeft.add(scrollTable); |
| | | frame.addComponentListener(new ComponentAdapter() { |
| | | @Override |
| | | public void componentResized(ComponentEvent e) { |
| | | |
| | | jLeft.setPreferredSize(new Dimension(width / 4 - 20, Compute.ComputeHeight(0, frame))); |
| | | scrollTable.setPreferredSize(new Dimension(width / 4 - 20, Compute.ComputeHeightWithScroll(0, frame))); |
| | | jLeft.revalidate(); |
| | | jLeft.repaint(); |
| | | scrollTable.revalidate(); |
| | | scrollTable.repaint(); |
| | | } |
| | | }); |
| | | |
| | | // 创建水平分割面板 |
| | | JSplitPane hSplitPane = new JSplitPane( |
| | |
| | | mxGraphComponent graphComponent = new mxGraphComponent(graph); |
| | | graphComponent.setConnectable(false); |
| | | graphComponent.setDragEnabled(false); |
| | | graphComponent.zoomTo(2, true); |
| | | graphComponent.zoomTo(1, true); |
| | | diagram.add(graphComponent); |
| | | |
| | | mxGraph finalGraph = graph; |
| | |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel2 data = list.get(r); |
| | | List<NetworkNodeStatusDto> nodeStatusList = level2Service.getNodeStatusData(data.getId()); |
| | | graph2[0] = netWorkDiagramService.getCsDiagram(graph2[0], data.getContent(), nodeStatusList, diagram.getPreferredSize().width, diagram.getPreferredSize().height); |
| | | mxGraph csDiagram = netWorkDiagramService.getCsDiagram(graph2[0], data.getContent(), nodeStatusList, diagram.getPreferredSize().width, diagram.getPreferredSize().height); |
| | | if (nodeStatusList != null && nodeStatusList.size() > 0) { |
| | | graph2[0] = csDiagram; |
| | | } else { |
| | | graph2[0].removeCells(graph2[0].getChildVertices(graph2[0].getDefaultParent())); |
| | | } |
| | | } |
| | | } |
| | | }); |