Skip to content
Snippets Groups Projects
Commit 9866684f authored by amaehrle's avatar amaehrle
Browse files

Add debugging tweaks for mobility models

Javadoc and comments might follow later
parent 0d3600ce
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -257,6 +257,10 @@ public class DTNSimGUI extends DTNSimUI { ...@@ -257,6 +257,10 @@ public class DTNSimGUI extends DTNSimUI {
infoPanel.showInfo(host); infoPanel.showInfo(host);
} }
public void highlightHost(DTNHost host) {
field.highlightHost(host);
}
/** /**
* Shows a path on the playfield * Shows a path on the playfield
* @param path The path to show * @param path The path to show
......
...@@ -252,6 +252,7 @@ public class EventLogPanel extends JPanel ...@@ -252,6 +252,7 @@ public class EventLogPanel extends JPanel
gui.setPaused(true); gui.setPaused(true);
if (host1 != null) { if (host1 != null) {
gui.setFocus(host1); gui.setFocus(host1);
gui.highlightHost(host1);
} }
} }
...@@ -316,6 +317,7 @@ public class EventLogPanel extends JPanel ...@@ -316,6 +317,7 @@ public class EventLogPanel extends JPanel
if (source.getClientProperty(HOST_PROP) != null) { if (source.getClientProperty(HOST_PROP) != null) {
// button was a host button -> focus it on GUI // button was a host button -> focus it on GUI
gui.setFocus((DTNHost)source.getClientProperty(HOST_PROP)); gui.setFocus((DTNHost)source.getClientProperty(HOST_PROP));
gui.highlightHost((DTNHost)source.getClientProperty(HOST_PROP));
} }
else if (source.getClientProperty(MSG_PROP) != null) { else if (source.getClientProperty(MSG_PROP) != null) {
// was a message button -> show information about the message // was a message button -> show information about the message
......
...@@ -73,6 +73,7 @@ public class MainWindow extends JFrame { ...@@ -73,6 +73,7 @@ public class MainWindow extends JFrame {
hostListScroll = new JScrollPane(chooser); hostListScroll = new JScrollPane(chooser);
hostListScroll.setHorizontalScrollBarPolicy( hostListScroll.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
hostListScroll.getVerticalScrollBar().setUnitIncrement(20);
logControlSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, logControlSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
new JScrollPane(elp.getControls()),new JScrollPane(elp)); new JScrollPane(elp.getControls()),new JScrollPane(elp));
......
...@@ -200,6 +200,7 @@ public class NodeChooser extends JPanel implements ActionListener { ...@@ -200,6 +200,7 @@ public class NodeChooser extends JPanel implements ActionListener {
JButton source = (JButton)e.getSource(); JButton source = (JButton)e.getSource();
DTNHost host = (DTNHost)source.getClientProperty(HOST_KEY); DTNHost host = (DTNHost)source.getClientProperty(HOST_KEY);
gui.setFocus(host); gui.setFocus(host);
gui.highlightHost(host);
} }
else if (e.getSource() == this.groupChooser) { else if (e.getSource() == this.groupChooser) {
setNodes(groupChooser.getSelectedIndex() * MAX_NODE_COUNT); setNodes(groupChooser.getSelectedIndex() * MAX_NODE_COUNT);
......
...@@ -121,7 +121,7 @@ public class SimMenuBar extends JMenuBar implements ActionListener { ...@@ -121,7 +121,7 @@ public class SimMenuBar extends JMenuBar implements ActionListener {
showBuffer = createCheckItem(pfMenu, showBuffer = createCheckItem(pfMenu,
"Show message buffer", true, SHOW_BUFFER_S); "Show message buffer", true, SHOW_BUFFER_S);
focusOnClick = createCheckItem(pfMenu, focusOnClick = createCheckItem(pfMenu,
"Focus to closest node on mouse click", false,FOCUS_ON_CLICK_S); "Focus to closest node on mouse click", true,FOCUS_ON_CLICK_S);
enableMapGraphic = createCheckItem(pfMenu,"Show map graphic", enableMapGraphic = createCheckItem(pfMenu,"Show map graphic",
true, null); true, null);
......
...@@ -341,12 +341,16 @@ public class PlayField extends JPanel implements VhmListener { ...@@ -341,12 +341,16 @@ public class PlayField extends JPanel implements VhmListener {
closestDist = dist; closestDist = dist;
} }
} }
highlightedHosts.clear();
highlightedHosts.add(closest);
NodeGraphic.setHighlightedNodes(highlightedHosts);
gui.setFocus(closest); gui.setFocus(closest);
highlightHost(closest);
}
public void highlightHost(DTNHost host) {
highlightedHosts.clear();
highlightedHosts.add(host);
NodeGraphic.setHighlightedNodes(highlightedHosts);
this.updateField(); this.updateField();
} }
......
  • Contributor
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment