/** * Examines the filter screen and creates a FilterData object that represents the data entered in * the screen. */ private FilterData getDataFromScreen() { FilterData data = new FilterData(); data.setFilterVar( (chkArchived.state ? "1" : "0") + (chkAvailable.state ? "1" : "0") + (chkFound.state ? "1" : "0") + (chkOwned.state ? "1" : "0") + (chkNotArchived.state ? "1" : "0") + (chkNotAvailable.state ? "1" : "0") + (chkNotFound.state ? "1" : "0") + (chkNotOwned.state ? "1" : "0")); data.setFilterType( (chkTrad.state ? "1" : "0") + (chkMulti.state ? "1" : "0") + (chkVirtual.state ? "1" : "0") + (chkLetter.state ? "1" : "0") + (chkEvent.state ? "1" : "0") + (chkWebcam.state ? "1" : "0") + (chkMystery.state ? "1" : "0") + (chkEarth.state ? "1" : "0") + (chkLocless.state ? "1" : "0") + (chkMega.state ? "1" : "0") + (chkCustom.state ? "1" : "0") + (chkParking.state ? "1" : "0") + (chkStage.state ? "1" : "0") + (chkQuestion.state ? "1" : "0") + (chkFinal.state ? "1" : "0") + (chkTrailhead.state ? "1" : "0") + (chkReference.state ? "1" : "0") + (chkCito.state ? "1" : "0") + (chkWherigo.state ? "1" : "0")); data.setFilterRose( (chkNW.state ? "1" : "0") + (chkNNW.state ? "1" : "0") + (chkN.state ? "1" : "0") + (chkNNE.state ? "1" : "0") + (chkNE.state ? "1" : "0") + (chkENE.state ? "1" : "0") + (chkE.state ? "1" : "0") + (chkESE.state ? "1" : "0") + (chkSE.state ? "1" : "0") + (chkSSE.state ? "1" : "0") + (chkS.state ? "1" : "0") + (chkSSW.state ? "1" : "0") + (chkSW.state ? "1" : "0") + (chkWSW.state ? "1" : "0") + (chkW.state ? "1" : "0") + (chkWNW.state ? "1" : "0")); data.setFilterSize( (chkMicro.state ? "1" : "0") + (chkSmall.state ? "1" : "0") + (chkRegular.state ? "1" : "0") + (chkLarge.state ? "1" : "0") + (chkVeryLarge.state ? "1" : "0") + (chkOther.state ? "1" : "0")); // Distance: If Metric system is set to imperial units, // then the entered value is meant to be miles, // otherwise it's kilometer. double distValue = java.lang.Double.NaN; String rawDistance = inpDist.getText().replace(',', '.'); String newDistance = rawDistance; // initial Value; if (!rawDistance.trim().equals("")) { distValue = java.lang.Double.valueOf(rawDistance).doubleValue(); if (Global.getPref().metricSystem == Metrics.IMPERIAL) { newDistance = String.valueOf(Metrics.convertUnit(distValue, Metrics.MILES, Metrics.KILOMETER)); } } if (chcDist.selectedIndex == 0) { data.setFilterDist("L" + newDistance); } else { data.setFilterDist("G" + newDistance); } if (chcDiff.selectedIndex == 0) { data.setFilterDiff("L" + inpDiff.getText()); } else if (chcDiff.selectedIndex == 1) { data.setFilterDiff("=" + inpDiff.getText()); } else { data.setFilterDiff("G" + inpDiff.getText()); } if (chcTerr.selectedIndex == 0) { data.setFilterTerr("L" + inpTerr.getText()); } else if (chcTerr.selectedIndex == 1) { data.setFilterTerr("=" + inpTerr.getText()); } else { data.setFilterTerr("G" + inpTerr.getText()); } data.setFilterAttrYes(attV.selectionMaskYes); data.setFilterAttrNo(attV.selectionMaskNo); data.setFilterAttrChoice(chcAttrib.selectedIndex); data.setFilterStatus(chcStatus.getText()); data.setUseRegexp(chkUseRegexp.getState()); return data; }