package event;

import hue.LightingClient;

import java.util.Date;

/**
 * Created by hubspot on 8/23/15.
 */
public class Mode {
    Date timeActive = new Date();
    public void handleBarProximity(boolean active) {
        if (active) {
            timeActive = new Date();
            LightingClient.changeSingleLight("bar", 0, 255, 255, 0);
        }
        else {
            LightingClient.changeSingleLight("bar", 0, 0, 0, 10000);
        }
    }
}

@@ -33,24 +33,119 @@
 ingClient;%0A%0A
+import javax.swing.*;%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0A
 import java.
@@ -248,24 +248,59 @@
 new Date();%0A
+    long turnOffDelay = 1000 * 10;%0A
     public v
@@ -464,16 +464,19 @@
 5, 255, 
+100
 0);%0A    
@@ -512,64 +512,572 @@
     
-LightingClient.changeSingleLight(%22bar%22, 0, 0, 0, 10000);
+if (new Date().getTime() - timeActive.getTime() %3C turnOffDelay) %7B%0A                Timer timer = new Timer((int)(new Date().getTime() - timeActive.getTime()), new ActionListener() %7B%0A%0A                    public void actionPerformed(ActionEvent arg0) %7B%0A                        LightingClient.changeSingleLight(%22bar%22, 0, 0, 0, 10000);%0A                    %7D%0A                %7D);%0A                timer.setRepeats(false);%0A                timer.start();%0A            %7D%0A            else %7B%0A                LightingClient.changeSingleLight(%22bar%22, 0, 0, 0, 10000);%0A            %7D
 %0A   

Hello timer