přidani tlacítka na restart
parent
27f3734ab0
commit
4ddacd74fe
|
|
@ -147,6 +147,7 @@ public class ClientMessageParser {
|
|||
MapObject new_mo = (MapObject) msg.getMsg();
|
||||
// pridat do seznamu
|
||||
Client.mapObject.add(new_mo);
|
||||
|
||||
break;
|
||||
|
||||
case Message.REMOVE_OBJECT:
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.awt.event.ActionListener;
|
|||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
|
@ -18,6 +19,7 @@ import javax.swing.JTextField;
|
|||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import jnet.lib.LogFile;
|
||||
import jnet.lib.Message;
|
||||
import jnet.lib.object.SnmpProfile;
|
||||
import jnet.lib.object.User;
|
||||
|
|
@ -63,36 +65,44 @@ public class ServerSettingsPanel extends JTabbedPane {
|
|||
pingLabel.setBounds(20, 20, 150, 25);
|
||||
panel.add(pingLabel);
|
||||
|
||||
JTextField repeateField = new JTextField(String.valueOf(Client.serverConfig.getPingAttempt()));
|
||||
repeateField.setBounds(x1, 60, 50, 25);
|
||||
panel.add(repeateField);
|
||||
|
||||
JLabel repeateLabel = new JLabel("Opakovat ping každých ... sekund");
|
||||
repeateLabel.setBounds(x2, 60, 300, 25);
|
||||
panel.add(repeateLabel);
|
||||
|
||||
JTextField pokusuField = new JTextField(String.valueOf(Client.serverConfig.getPingAttempt()));
|
||||
pokusuField.setBounds(x1, 60, 50, 25);
|
||||
pokusuField.setBounds(x1, 100, 50, 25);
|
||||
panel.add(pokusuField);
|
||||
|
||||
JLabel pokusuLabel = new JLabel("Počet pokusů před vyhodnocenim offline");
|
||||
pokusuLabel.setBounds(x2, 60, 300, 25);
|
||||
pokusuLabel.setBounds(x2, 100, 300, 25);
|
||||
panel.add(pokusuLabel);
|
||||
|
||||
JTextField timeoutField = new JTextField(String.valueOf(Client.serverConfig.getPingTimeout()));
|
||||
timeoutField.setBounds(x1, 100, 50, 25);
|
||||
timeoutField.setBounds(x1, 140, 50, 25);
|
||||
panel.add(timeoutField);
|
||||
|
||||
JLabel timeoutLabel = new JLabel("Úroveň timeout (ms)");
|
||||
timeoutLabel.setBounds(x2, 100, 300, 25);
|
||||
JLabel timeoutLabel = new JLabel("Úroveň timeout (s)");
|
||||
timeoutLabel.setBounds(x2, 140, 300, 25);
|
||||
panel.add(timeoutLabel);
|
||||
|
||||
JTextField pokusuNestField = new JTextField(String.valueOf(Client.serverConfig.getInstabilityAttempt()));
|
||||
pokusuNestField.setBounds(x1, 140, 50, 25);
|
||||
pokusuNestField.setBounds(x1, 180, 50, 25);
|
||||
panel.add(pokusuNestField);
|
||||
|
||||
JLabel pokusuNestLabel = new JLabel("Počet pokusů před vyhodnocením nestability");
|
||||
pokusuNestLabel.setBounds(x2, 140, 300, 25);
|
||||
pokusuNestLabel.setBounds(x2, 180, 300, 25);
|
||||
panel.add(pokusuNestLabel);
|
||||
|
||||
JTextField nestField = new JTextField(String.valueOf(Client.serverConfig.getInstabilityLimit()));
|
||||
nestField.setBounds(x1, 180, 50, 25);
|
||||
nestField.setBounds(x1, 220, 50, 25);
|
||||
panel.add(nestField);
|
||||
|
||||
JLabel nestLabel = new JLabel("Úroveň nestability (ms)");
|
||||
nestLabel.setBounds(x2, 180, 300, 25);
|
||||
JLabel nestLabel = new JLabel("Úroveň nestability (s)");
|
||||
nestLabel.setBounds(x2, 220, 300, 25);
|
||||
panel.add(nestLabel);
|
||||
|
||||
JButton button = new JButton("Uložit");
|
||||
|
|
@ -100,6 +110,7 @@ public class ServerSettingsPanel extends JTabbedPane {
|
|||
button.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Client.serverConfig.setPingRepeat(Integer.valueOf(repeateField.getText()));
|
||||
Client.serverConfig.setPingAttempt(Integer.valueOf(pokusuField.getText()));
|
||||
Client.serverConfig.setPingTimeout(Integer.valueOf(timeoutField.getText()));
|
||||
Client.serverConfig.setInstabilityAttempt(Integer.valueOf(pokusuNestField.getText()));
|
||||
|
|
@ -107,9 +118,28 @@ public class ServerSettingsPanel extends JTabbedPane {
|
|||
NettyClient.send(Message.SERVER_CONFIG, Client.serverConfig);
|
||||
}
|
||||
});
|
||||
button.setBounds(x1, 220, 100, 40);
|
||||
button.setBounds(x1, 300, 100, 40);
|
||||
panel.add(button);
|
||||
|
||||
JButton buttonRestart = new JButton("Restartovat server");
|
||||
//buttonRestart.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||
buttonRestart.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int result = JOptionPane.showConfirmDialog(null,
|
||||
"Opravdu chceš pokračovat?",
|
||||
"Restart serveru",
|
||||
JOptionPane.YES_NO_OPTION);
|
||||
|
||||
if (result == JOptionPane.YES_OPTION) {
|
||||
LogFile.printInfo("Odeslan pozadavek na restart serveru");
|
||||
NettyClient.send(Message.RESTART, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
buttonRestart.setBounds(x1+200, 300, 150, 40);
|
||||
panel.add(buttonRestart);
|
||||
|
||||
return new JScrollPane(panel);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue