/** * A row is used for one "sensor value" (e.g. Ax, Ay or Az). It contains the name of the sensor * value and a {@link GeoListBox} to choose an element to which the received values should be * logged. * * @param rowCaption caption * @param type {@link Types} */ protected void addRow(String rowCaption, Types type) { FlowPanel container = new FlowPanel(); container.addStyleName("rowContainer"); Label rowCaptionLabel = new Label(); container.add(rowCaptionLabel); rowCaptions.put(rowCaptionLabel, rowCaption); GeoListBox listBox = new GeoListBox(type, this, app, this.view.getDataSettings()); listBox.addChangeHandler(this.view); this.listBoxes.add(listBox); container.add(listBox); dataValues.add(container); updateContent(); }
/** * 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); } }
/** * 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()); } } }