use of il.ac.technion.cs.smarthouse.simulator.model.SensorField in project Smartcity-Smarthouse by TechnionYP5777.
the class MessageViewController method buildStreamModePane.
void buildStreamModePane() {
streamFieldMap = new HashMap<>();
int currentRow = 0;
streamMode.add(new Label("Name"), 0, currentRow);
streamMode.add(new Label("From"), 1, currentRow);
streamMode.add(new Label("To"), 2, currentRow++);
for (final SensorField ¢ : currentSensor.getFields()) {
streamMode.add(new Label(¢.getName()), 0, currentRow);
final List<Node> nodes = new ArrayList<>();
if (¢.getType() == Types.BOOLEAN) {
final ComboBox<BooleanValues> b = new ComboBox<>();
b.getItems().addAll(BooleanValues.values());
streamMode.add(b, 1, currentRow);
nodes.add(b);
} else {
final TextField t1 = new TextField(), t2 = new TextField();
streamMode.add(t1, 1, currentRow);
nodes.add(t1);
if (¢.getType() != Types.STRING) {
streamMode.add(t2, 2, currentRow);
nodes.add(t2);
}
}
streamFieldMap.put(¢, nodes);
++currentRow;
}
streamMode.add(new Label("Send Interval(integer only):"), 0, currentRow);
final TextField t1 = new TextField(), t2 = new TextField();
streamMode.add(t1, 1, currentRow);
streamMode.add(t2, 2, currentRow);
timeInput = new Pair<>(t1, t2);
}
use of il.ac.technion.cs.smarthouse.simulator.model.SensorField in project Smartcity-Smarthouse by TechnionYP5777.
the class MessageViewController method buildMessage.
@SuppressWarnings("unchecked")
void buildMessage() {
String message = "";
for (final SensorField field : singleFieldMap.keySet()) {
message += " " + field.getName() + " ";
if (field.getType() == Types.BOOLEAN)
message += ((ComboBox<BooleanValues>) singleFieldMap.get(field)).getValue();
else {
final String Input = ((TextField) singleFieldMap.get(field)).getText();
if (!validateInput(Input, field.getType()))
return;
message += Input;
}
}
message += "\n";
showMessage(message);
}
use of il.ac.technion.cs.smarthouse.simulator.model.SensorField in project Smartcity-Smarthouse by TechnionYP5777.
the class MessageViewController method buildSingleModePane.
void buildSingleModePane() {
singleFieldMap = new HashMap<>();
int currentRow = 0;
singleMode.add(new Label("Name"), 0, currentRow);
singleMode.add(new Label("Value"), 1, currentRow++);
for (final SensorField ¢ : currentSensor.getFields()) {
singleMode.add(new Label(¢.getName()), 0, currentRow);
if (¢.getType() != Types.BOOLEAN) {
final TextField t = new TextField();
singleMode.add(t, 1, currentRow);
singleFieldMap.put(¢, t);
} else {
final ComboBox<BooleanValues> b = new ComboBox<>();
b.getItems().addAll(BooleanValues.values());
singleMode.add(b, 1, currentRow);
singleFieldMap.put(¢, b);
}
++currentRow;
}
}