minor update in highlighted motes
This commit is contained in:
parent
490bc06de2
commit
fc056f97f9
1 changed files with 12 additions and 8 deletions
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: Visualizer2D.java,v 1.10 2007/05/30 10:54:22 fros4943 Exp $
|
||||
* $Id: Visualizer2D.java,v 1.11 2007/05/30 20:57:58 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.cooja.plugins;
|
||||
|
@ -88,6 +88,7 @@ public abstract class Visualizer2D extends VisPlugin {
|
|||
private Observer moteHighligtObserver = null;
|
||||
private Mote highlightedMote = null;
|
||||
private Color highlightColor = Color.GRAY;
|
||||
private Timer highlightTimer = null;
|
||||
|
||||
public interface MoteMenuAction {
|
||||
public boolean isEnabled(Mote mote);
|
||||
|
@ -189,14 +190,17 @@ public abstract class Visualizer2D extends VisPlugin {
|
|||
public void update(Observable obs, Object obj) {
|
||||
if (!(obj instanceof Mote))
|
||||
return;
|
||||
|
||||
|
||||
if (highlightTimer != null && highlightTimer.isRunning())
|
||||
highlightTimer.stop();
|
||||
|
||||
highlightTimer = new Timer(100, null);
|
||||
highlightedMote = (Mote) obj;
|
||||
final Timer timer = new Timer(100, null);
|
||||
timer.addActionListener(new ActionListener() {
|
||||
highlightTimer.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// Decrease delay
|
||||
if (timer.getDelay() < 90) {
|
||||
timer.stop();
|
||||
if (highlightTimer.getDelay() < 90) {
|
||||
highlightTimer.stop();
|
||||
highlightedMote = null;
|
||||
repaint();
|
||||
return;
|
||||
|
@ -207,11 +211,11 @@ public abstract class Visualizer2D extends VisPlugin {
|
|||
highlightColor = Color.CYAN;
|
||||
else
|
||||
highlightColor = Color.GRAY;
|
||||
timer.setDelay(timer.getDelay()-1);
|
||||
highlightTimer.setDelay(highlightTimer.getDelay()-1);
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
timer.start();
|
||||
highlightTimer.start();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue