| | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.model.TableButton; |
| | | 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.DjJdgzNetworkLevel1List; |
| | |
| | | import com.example.server.progressTrack.service.DjJdgzShipService; |
| | | import com.example.server.progressTrack.service.NetWorkDiagramService; |
| | | import com.mxgraph.swing.mxGraphComponent; |
| | | import com.mxgraph.util.mxPoint; |
| | | import com.mxgraph.util.mxRectangle; |
| | | import com.mxgraph.view.mxGraph; |
| | | import com.teamdev.jxbrowser.chromium.StopFindAction; |
| | | import org.jdesktop.swingx.JXDatePicker; |
| | |
| | | @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)); |
| | |
| | | List<DjJdgzNetworkLevel1> list = level1Service.getList(null); |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | |
| | | if (list == null || list.size() == 0) { |
| | | JOptionPane.showMessageDialog(null, "还未录入一级网络图数据", "提示", JOptionPane.WARNING_MESSAGE); |
| | | return null; |
| | | } |
| | | |
| | | columnDto.add(new ColumnDto("序号", "", width / 8 - 10, "autoCreate", false, null,null)); |
| | | columnDto.add(new ColumnDto("工程", "ProjectName", width / 8, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("序号", "", width / 8 - 10, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("工程", "ProjectName", width / 8, 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( |
| | | JSplitPane.HORIZONTAL_SPLIT, |
| | |
| | | String json = list.get(0).getContent(); |
| | | List<NetworkNodeStatusDto> nodeStatusList = level1Service.getNodeStatusData(list.get(0).getId()); |
| | | |
| | | graph = netWorkDiagramService.getCsDiagram(graph, json, nodeStatusList, diagram.getPreferredSize().width, diagram.getPreferredSize().height); |
| | | graph = netWorkDiagramService.getCsDiagram(graph, json, nodeStatusList, diagram.getPreferredSize().width, diagram.getPreferredSize().height,null); |
| | | |
| | | 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(); |
| | | DjJdgzNetworkLevel1 data = list.get(r); |
| | | List<NetworkNodeStatusDto> nodeStatusList = level1Service.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,null); |
| | | if (nodeStatusList != null && nodeStatusList.size() > 0) { |
| | | graph2[0] = csDiagram; |
| | | } else { |
| | | graph2[0].removeCells(graph2[0].getChildVertices(graph2[0].getDefaultParent())); |
| | | } |
| | | } |
| | | } |
| | | }); |