zsh_root
2025-12-10 8d662de2fd262b3a485f16e197cb4d0ca2a61cdf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
package PublicPannel;
 
import javax.swing.*;
 
import home.MainFrame;
import jiexi.DellTag55AA03;
 
import java.awt.*;
public class BaseStationPanel extends JPanel {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private MainFrame mainFrame;
    private JLabel[] labels;
    private JTextField[] textFields;
 
    public BaseStationPanel(MainFrame mainFrame) {
        this.mainFrame = mainFrame;
        initializeUI();
    }
 
    private void initializeUI() {
        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
 
        // 氝樓價桴統杅砐
        String[][] parameters = {
                {"18.", "external.control"},
                {"20.", "adjacent.stations.count"},
                {"22.", "adjacent.station1"},
                {"24.", "adjacent.station2"},
                {"26.", "adjacent.station3"},
                {"28.", "adjacent.station4"},
                {"2A.", "adjacent.station5"},
                {"2C.", "adjacent.station6"},
                {"2E.", "adjacent.station7"},
                {"30.", "adjacent.station8"},
                {"32.", "adjacent.station9"},
                {"34.", "adjacent.station10"},
                {"44.", "sync.station.id"},
                {"46.", "sync.station.type"}
        };
 
        labels = new JLabel[parameters.length];
        textFields = new JTextField[parameters.length];
 
        for (int i = 0; i < parameters.length; i++) {
            addParameterField(this, parameters[i][0], parameters[i][1], i);
        }
    }
 
    private void addParameterField(JPanel panel, String address, String paramKey, int index) {
        JPanel paramPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0));
 
        labels[index] = new JLabel(address + " " + mainFrame.getString(paramKey));
        labels[index].setPreferredSize(new Dimension(140, 25));
 
        textFields[index] = new JTextField();
        textFields[index].setPreferredSize(new Dimension(120, 25));
 
        paramPanel.add(labels[index]);
        paramPanel.add(textFields[index]);
 
        // 氝樓潔擒
        paramPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 35));
        panel.add(paramPanel);
    }
 
    public void updateLanguage() {
        // 載陔垀衄梓ワ腔恅掛
        String[][] parameters = {
                {"18.", "external.control"},
                {"20.", "adjacent.stations.count"},
                {"22.", "adjacent.station1"},
                {"24.", "adjacent.station2"},
                {"26.", "adjacent.station3"},
                {"28.", "adjacent.station4"},
                {"2A.", "adjacent.station5"},
                {"2C.", "adjacent.station6"},
                {"2E.", "adjacent.station7"},
                {"30.", "adjacent.station8"},
                {"32.", "adjacent.station9"},
                {"34.", "adjacent.station10"},
                {"44.", "sync.station.id"},
                {"46.", "sync.station.type"}
        };
 
        for (int i = 0; i < parameters.length && i < labels.length; i++) {
            labels[i].setText(parameters[i][0] + " " + mainFrame.getString(parameters[i][1]));
        }
 
        revalidate();
        repaint();
    }
 
    // 新增:获取文本框数组的方法
    public JTextField[] getTextFields() {
        return textFields;
    }
    /**
     * 更新基站面板字段
     */
    public void updateFields(DellTag55AA03.ParseResult result) {
        if (result == null) {
            
            return;
        }
 
        
 
        try {
            // 根据参数顺序更新对应的文本框
            if (textFields.length > 0 && result.dizhi0x18 != null) {
                textFields[0].setText(String.valueOf(result.dizhi0x18)); // 外设控制
            }
 
            if (textFields.length > 1 && result.dizhi0x20 != null) {
                textFields[1].setText(String.valueOf(result.dizhi0x20)); // 临近基站数量
            }
 
            if (textFields.length > 2 && result.dizhi0x22 != null) {
                textFields[2].setText(result.dizhi0x22); // 临近基站1
            }
 
            if (textFields.length > 3 && result.dizhi0x24 != null) {
                textFields[3].setText(result.dizhi0x24); // 临近基站2
            }
 
            if (textFields.length > 4 && result.dizhi0x26 != null) {
                textFields[4].setText(result.dizhi0x26); // 临近基站3
            }
 
            if (textFields.length > 5 && result.dizhi0x28 != null) {
                textFields[5].setText(result.dizhi0x28); // 临近基站4
            }
 
            if (textFields.length > 6 && result.dizhi0x2A != null) {
                textFields[6].setText(result.dizhi0x2A); // 临近基站5
            }
 
            if (textFields.length > 7 && result.dizhi0x2C != null) {
                textFields[7].setText(result.dizhi0x2C); // 临近基站6
            }
 
            if (textFields.length > 8 && result.dizhi0x2E != null) {
                textFields[8].setText(result.dizhi0x2E); // 临近基站7
            }
 
            if (textFields.length > 9 && result.dizhi0x30 != null) {
                textFields[9].setText(result.dizhi0x30); // 临近基站8
            }
 
            if (textFields.length > 10 && result.dizhi0x32 != null) {
                textFields[10].setText(result.dizhi0x32); // 临近基站9
            }
 
            if (textFields.length > 11 && result.dizhi0x34 != null) {
                textFields[11].setText(result.dizhi0x34); // 临近基站10
            }
 
            if (textFields.length > 12 && result.dizhi0x44 != null) {
                textFields[12].setText(result.dizhi0x44); // 同步基站ID
            }
 
            if (textFields.length > 13 && result.dizhi0x46 != null) {
                textFields[13].setText(String.valueOf(result.dizhi0x46)); // 同步基站类型
            }
 
        } catch (Exception e) {
            System.err.println("Error updating BaseStationPanel fields: " + e.getMessage());
            e.printStackTrace();
        }
 
        // 重新验证和重绘面板
        revalidate();
        repaint();
 
    }
    public String getdizhi0x18() {
        return textFields.length > 0 ? textFields[0].getText() : "";
    }//外设控制
 
    public String getdizhi0x20() {
        return textFields.length > 1 ? textFields[1].getText() : "";
    }//临近基站数量
 
    public String getdizhi0x22() {
        return textFields.length > 2 ? textFields[2].getText() : "";
    }//临近基站1
 
    public String getdizhi0x24() {
        return textFields.length > 3 ? textFields[3].getText() : "";
    }//临近基站2
 
    public String getdizhi0x26() {
        return textFields.length > 4 ? textFields[4].getText() : "";
    }//临近基站3
 
    public String getdizhi0x28() {
        return textFields.length > 5 ? textFields[5].getText() : "";
    }//临近基站4
 
    public String getdizhi0x2A() {
        return textFields.length > 6 ? textFields[6].getText() : "";
    }//临近基站5
 
    public String getdizhi0x2C() {
        return textFields.length > 7 ? textFields[7].getText() : "";
    }//临近基站6
 
    public String getdizhi0x2E() {
        return textFields.length > 8 ? textFields[8].getText() : "";
    }//临近基站7
 
    public String getdizhi0x30() {
        return textFields.length > 9 ? textFields[9].getText() : "";
    }//临近基站8
 
    public String getdizhi0x32() {
        return textFields.length > 10 ? textFields[10].getText() : "";
    }//临近基站9
 
    public String getdizhi0x34() {
        return textFields.length > 11 ? textFields[11].getText() : "";
    }//临近基站10
 
    public String getdizhi0x44() {
        return textFields.length > 12 ? textFields[12].getText() : "";
    }//同步基站ID
 
    public String getdizhi0x46() {
        return textFields.length > 13 ? textFields[13].getText() : "";
    }//同步基站类型
}