| | |
| | | import dikuai.Dikuaiguanli; |
| | | import bianjie.bianjieguihua2; |
| | | import lujing.Lunjingguihua; |
| | | import set.Setsys; |
| | | import ui.UIConfig; |
| | | import zhuye.MowerLocationData; |
| | | import zhuye.Shouye; |
| | | import zhuye.Coordinate; |
| | | import zhuye.buttonset; |
| | | |
| | | /** |
| | | * 新增地块对话框 - 多步骤表单设计 |
| | |
| | | formGroup.add(areaNameField); |
| | | formGroup.add(Box.createRigidArea(new Dimension(0, 8))); |
| | | formGroup.add(hintLabel); |
| | | |
| | | formGroup.add(Box.createRigidArea(new Dimension(0, 20))); |
| | | JPanel obstacleSection = createObstacleSummarySection(); |
| | | formGroup.add(obstacleSection); |
| | | |
| | | stepPanel.add(formGroup); |
| | | stepPanel.add(Box.createVerticalGlue()); |
| | |
| | | if (!optionPanel.isEnabled()) { |
| | | return; |
| | | } |
| | | selectDrawingOption(optionPanel, type); |
| | | startEndDrawingBtn.setEnabled(true); // 选择后启用按钮 |
| | | if (selectDrawingOption(optionPanel, type, true)) { |
| | | startEndDrawingBtn.setEnabled(true); // 选择后启用按钮 |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | return optionPanel; |
| | | } |
| | | |
| | | private void selectDrawingOption(JPanel optionPanel, String type) { |
| | | private boolean selectDrawingOption(JPanel optionPanel, String type, boolean userTriggered) { |
| | | if (optionPanel == null) { |
| | | return false; |
| | | } |
| | | if (userTriggered && "handheld".equalsIgnoreCase(type) && !hasConfiguredHandheldMarker()) { |
| | | JOptionPane.showMessageDialog(this, "请先添加便携打点器编号", "提示", JOptionPane.WARNING_MESSAGE); |
| | | return false; |
| | | } |
| | | |
| | | // 重置之前选中的选项 |
| | | if (selectedOptionPanel != null) { |
| | | selectedOptionPanel.setBorder(BorderFactory.createLineBorder(BORDER_COLOR, 2)); |
| | |
| | | ((JLabel) oldTitle).setForeground(TEXT_COLOR); |
| | | } |
| | | } |
| | | |
| | | |
| | | // 设置新的选中状态 |
| | | optionPanel.setBorder(BorderFactory.createLineBorder(PRIMARY_COLOR, 3)); |
| | | optionPanel.setBackground(PRIMARY_LIGHT); |
| | |
| | | ((JLabel) titleObj).setForeground(PRIMARY_COLOR); |
| | | } |
| | | selectedOptionPanel = optionPanel; |
| | | |
| | | |
| | | // 保存选择 |
| | | dikuaiData.put("drawingMethod", type); |
| | | return true; |
| | | } |
| | | |
| | | private boolean hasConfiguredHandheldMarker() { |
| | | String handheldId = Setsys.getPropertyValue("handheldMarkerId"); |
| | | return handheldId != null && !handheldId.trim().isEmpty(); |
| | | } |
| | | |
| | | private void toggleDrawing() { |
| | |
| | | } |
| | | |
| | | private JButton createPrimaryButton(String text, int fontSize) { |
| | | JButton button = new JButton(text); |
| | | JButton button = buttonset.createStyledButton(text, PRIMARY_COLOR); |
| | | button.setFont(new Font("微软雅黑", Font.BOLD, fontSize)); |
| | | button.setBackground(PRIMARY_COLOR); |
| | | button.setForeground(WHITE); |
| | | button.setBorder(BorderFactory.createCompoundBorder( |
| | | BorderFactory.createLineBorder(PRIMARY_DARK, 2), |
| | | BorderFactory.createEmptyBorder(12, 25, 12, 25) |
| | | )); |
| | | button.setFocusPainted(false); |
| | | button.setCursor(new Cursor(Cursor.HAND_CURSOR)); |
| | | |
| | | // 按钮悬停效果 |
| | | |
| | | button.addMouseListener(new MouseAdapter() { |
| | | @Override |
| | | public void mouseEntered(MouseEvent e) { |
| | |
| | | button.setBackground(PRIMARY_DARK); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void mouseExited(MouseEvent e) { |
| | | if (button.isEnabled()) { |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | return button; |
| | | } |
| | | |
| | |
| | | buttonPanel.setBackground(WHITE); |
| | | buttonPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0)); |
| | | |
| | | prevButton = new JButton("上一步"); |
| | | prevButton = buttonset.createStyledButton("上一步", MEDIUM_GRAY); |
| | | prevButton.setFont(new Font("微软雅黑", Font.BOLD, 16)); |
| | | prevButton.setBackground(MEDIUM_GRAY); |
| | | prevButton.setForeground(TEXT_COLOR); |
| | | prevButton.setBorder(BorderFactory.createCompoundBorder( |
| | | BorderFactory.createLineBorder(BORDER_COLOR, 2), |
| | | BorderFactory.createEmptyBorder(10, 25, 10, 25) |
| | | )); |
| | | prevButton.setFocusPainted(false); |
| | | prevButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); |
| | | |
| | | nextButton = createPrimaryButton("下一步", 16); |
| | |
| | | private void showStep(int step) { |
| | | currentStep = step; |
| | | cardLayout.show(stepsPanel, "step" + step); |
| | | |
| | | if (step == 1) { |
| | | updateObstacleSummary(); |
| | | } |
| | | |
| | | // 更新按钮状态 |
| | | updateButtonState(step); |
| | |
| | | if (method != null) { |
| | | JPanel panel = drawingOptionPanels.get(method); |
| | | if (panel != null) { |
| | | selectDrawingOption(panel, method); |
| | | selectDrawingOption(panel, method, false); |
| | | } |
| | | } |
| | | |