plugin is updated to support non-visualized simulations

This commit is contained in:
fros4943 2010-03-25 08:00:15 +00:00
parent 1daee93f63
commit 20d9f70b09

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: SerialSocketServer.java,v 1.2 2010/03/19 15:03:14 fros4943 Exp $ * $Id: SerialSocketServer.java,v 1.3 2010/03/25 08:00:15 fros4943 Exp $
*/ */
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -118,7 +118,9 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
try { try {
logger.info("Listening on port: " + LISTEN_PORT); logger.info("Listening on port: " + LISTEN_PORT);
statusLabel.setText("Listening on port: " + LISTEN_PORT); if (GUI.isVisualized()) {
statusLabel.setText("Listening on port: " + LISTEN_PORT);
}
server = new ServerSocket(LISTEN_PORT); server = new ServerSocket(LISTEN_PORT);
new Thread() { new Thread() {
public void run() { public void run() {
@ -130,7 +132,9 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
out.flush(); out.flush();
startSocketReadThread(in); startSocketReadThread(in);
statusLabel.setText("Client connected: " + client.getInetAddress()); if (GUI.isVisualized()) {
statusLabel.setText("Client connected: " + client.getInetAddress());
}
} catch (IOException e) { } catch (IOException e) {
logger.fatal("Listening thread shut down: " + e.getMessage()); logger.fatal("Listening thread shut down: " + e.getMessage());
server = null; server = null;
@ -242,11 +246,13 @@ public class SerialSocketServer extends VisPlugin implements MotePlugin {
} catch (IOException e) { } catch (IOException e) {
} }
SwingUtilities.invokeLater(new Runnable() { if (GUI.isVisualized()) {
public void run() { SwingUtilities.invokeLater(new Runnable() {
statusLabel.setText("Listening on port: " + LISTEN_PORT); public void run() {
} statusLabel.setText("Listening on port: " + LISTEN_PORT);
}); }
});
}
} }
public void closePlugin() { public void closePlugin() {