88import edu .wpi .grip .core .util .service .RestartableService ;
99import edu .wpi .grip .core .util .service .SingleActionListener ;
1010import edu .wpi .grip .ui .util .DPIUtility ;
11+ import javafx .animation .FadeTransition ;
12+ import javafx .animation .Transition ;
1113import javafx .application .Platform ;
1214import javafx .scene .control .ContentDisplay ;
1315import javafx .scene .control .ToggleButton ;
1719import javafx .scene .input .MouseEvent ;
1820import javafx .scene .layout .HBox ;
1921import javafx .scene .layout .Priority ;
22+ import javafx .util .Duration ;
2023
2124import java .util .Arrays ;
2225import java .util .List ;
@@ -90,7 +93,7 @@ private List<String> getCurrentStyleClasses() {
9093 }
9194
9295 /**
93- * Assigns the state of the button from the {@link StartStoppable }
96+ * Assigns the state of the button from the {@link RestartableService }
9497 */
9598 private void assignState () {
9699 setSelected (service .isRunning ());
@@ -104,7 +107,16 @@ private void assignState() {
104107 * @return The graphic to show on the button.
105108 */
106109 private static ImageView pickGraphic (RestartableService startStoppable ) {
107- final ImageView icon = startStoppable .isRunning () ? new ImageView (stopImage ) : new ImageView (startImage );
110+ final boolean running = startStoppable .isRunning ();
111+ final ImageView icon = running ? new ImageView (stopImage ) : new ImageView (startImage );
112+ if (!running ) {
113+ // If we are not running then we want the icon to flash
114+ final FadeTransition ft = new FadeTransition (Duration .millis (750 ), icon );
115+ ft .setToValue (0.1 );
116+ ft .setCycleCount (Transition .INDEFINITE );
117+ ft .setAutoReverse (true );
118+ ft .play ();
119+ }
108120 icon .setFitHeight (DPIUtility .MINI_ICON_SIZE );
109121 icon .setFitWidth (DPIUtility .MINI_ICON_SIZE );
110122 return icon ;
0 commit comments