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));
|
|
// ßÇrèõ½yf³X
|
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() {
|
// ÝdÚë~ô¬è÷¥ïÇ»`ì
|
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() : "";
|
}//ͬ²½»ùÕ¾ÀàÐÍ
|
}
|