From bf5b01b14dc7bfc214e646425a62f5593890d7e3 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期六, 08 十一月 2025 22:05:37 +0800
Subject: [PATCH] 清洗数据库日期错误,并且导入日期通用化处理
---
src/main/java/com/example/client/service/Level1ViewService.java | 50 +++++++++++++++++++++++++++++++++++++-------------
1 files changed, 37 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/example/client/service/Level1ViewService.java b/src/main/java/com/example/client/service/Level1ViewService.java
index 2660d99..f2535c4 100644
--- a/src/main/java/com/example/client/service/Level1ViewService.java
+++ b/src/main/java/com/example/client/service/Level1ViewService.java
@@ -3,6 +3,7 @@
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;
@@ -11,6 +12,8 @@
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;
@@ -37,12 +40,13 @@
@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));
@@ -53,17 +57,32 @@
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,
@@ -81,12 +100,12 @@
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;
@@ -110,7 +129,12 @@
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()));
+ }
}
}
});
--
Gitblit v1.9.1