jinlin
2025-03-18 d30e385951ce03335a5023f0775fd144da3c0b88
src/main/java/com/example/client/service/Level2ViewService.java
@@ -2,6 +2,7 @@
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;
@@ -15,10 +16,7 @@
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;
@@ -30,12 +28,12 @@
    @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));
@@ -47,16 +45,29 @@
        //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(
@@ -80,7 +91,7 @@
        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;
@@ -104,7 +115,12 @@
                    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()));
                    }
                }
            }
        });