/** * if sensor is set to ON the SensorLogger starts logging data for this sensor. * * @param flag {@code true} to turn sensor ON */ public void setOn(boolean flag) { this.sensorIsOn = flag; sensorOnOff.clear(); setRealFreqVisible(flag); if (flag) { sensorOnOff.add(sensorON); for (GeoListBox listbox : listBoxes) { if (listbox.getSelection() != null) { ((AppWFull) app) .getDataCollection() .registerGeo(listbox.getType().toString(), listbox.getSelection()); } } } else { sensorOnOff.add(sensorOFF); for (GeoListBox listbox : listBoxes) { ((AppWFull) app).getDataCollection().removeRegisteredGeo(listbox.getType()); } } }
/** * updates the entries of the given {@link GeoListBox} * * @param box * @param availableObjects * @param usedObjects {@link ArrayList} */ private void updateBox( GeoListBox box, ArrayList<GeoElement> availableObjects, ArrayList<GeoElement> usedObjects) { GeoElement selectedElem = box.getSelection(); box.clear(); if (selectedElem != null && usedObjects.contains(selectedElem)) { box.addItem(selectedElem); box.setSelection(selectedElem); box.setSelectedIndex(box.getFirstFreeGeoListBoxIndex()); } else { box.setSelection(null); } for (GeoElement elem : availableObjects) { box.addItem(elem); } }