public boolean connectionRequest(DatagramPacket aDatagramPacket) { if (aDatagramPacket.getSocketAddress().equals(mSocketAddress)) { String vXMLString = new String(aDatagramPacket.getData(), 0, aDatagramPacket.getLength()); GraphicsManagement.getLogger() .debug( "Connection request (" + ((InetSocketAddress) aDatagramPacket.getSocketAddress()).toString() + "):" + vXMLString); ConnectionRequest vConnectionRequest = ConnectionRequest.unmarshallXMLConnectionRequestString(vXMLString); if (vConnectionRequest != null) { mClientName = vConnectionRequest.getClientGraphicsName(); String vAcknowlegeRequest = (new ConnectionAcknowlege( Core.getInstance().getServerConfig().getServerName(), mClientName, true)) .toXMLString(); mGraphicsConnection.sendString(vAcknowlegeRequest, mSocketAddress); return true; } } return false; }
/** Create the panel. */ public Server() { setLayout(null); JLabel lblServername = new JLabel("Servername"); lblServername.setBounds(10, 11, 145, 14); add(lblServername); mServerName = new JTextField(); mServerName.setBounds(10, 25, 286, 20); add(mServerName); mServerName.setColumns(10); mServerName.setText(Core.getInstance().getServerConfig().getServerName()); JButton btnNewButton = new JButton("Save settings to file"); btnNewButton.setBounds(10, 56, 286, 23); add(btnNewButton); reload(); }
void reload() { mServerName.setText(Core.getInstance().getServerConfig().getServerName()); }
void save() { Core.getInstance().getServerConfig().setServerName(mServerName.getText()); }