The time can be set within the GUI
This commit is contained in:
@@ -2,7 +2,6 @@ package de.c3ma.ollo.mockup.ui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Event;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -11,8 +10,8 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -26,7 +25,6 @@ import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
|
||||
import de.c3ma.ollo.LuaSimulation;
|
||||
import javafx.scene.control.DatePicker;
|
||||
|
||||
/**
|
||||
* created at 02.01.2018 - 12:57:02<br />
|
||||
@@ -124,7 +122,13 @@ public class WS2812Layout extends JFrame {
|
||||
final String pattern = "(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})";
|
||||
final String current = dateTime.getText();
|
||||
|
||||
|
||||
if (current.length() <=0) {
|
||||
/* color "nothing" green */
|
||||
dateTime.setForeground(Color.GREEN);
|
||||
/* disable the time simulation */
|
||||
nodemcuSimu.setSimulationTime(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!current.matches(pattern)) {
|
||||
dateTime.setForeground(Color.RED);
|
||||
@@ -161,7 +165,10 @@ public class WS2812Layout extends JFrame {
|
||||
break;
|
||||
}
|
||||
}
|
||||
System.out.println("Set time to: " + year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second);
|
||||
System.out.println("[GUI] Set time to: " + year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second);
|
||||
GregorianCalendar gc = new GregorianCalendar(year, month, day, hour, minute, second);
|
||||
|
||||
nodemcuSimu.setSimulationTime(gc.getTimeInMillis());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user