/** * Creates a new ExerciseFilter domain object from the edited JavaFX properties. * * @return ExerciseFilter */ public ExerciseFilter getExerciseFilter() { final ExerciseFilter exerciseFilter = new ExerciseFilter(); exerciseFilter.setDateStart(dateStart.get()); exerciseFilter.setDateEnd(dateEnd.get()); exerciseFilter.setSportType(sportType.get()); exerciseFilter.setSportSubType(sportSubtype.get()); exerciseFilter.setIntensity(intensity.get().intensityType); exerciseFilter.setEquipment(equipment.get()); exerciseFilter.setCommentSubString(StringUtils.getTrimmedTextOrNull(commentSubString.get())); exerciseFilter.setRegularExpressionMode(regularExpressionMode.get()); return exerciseFilter; }
/** * Creates the FilterViewModel with JavaFX properties for the passed ExerciseFilter object. * * @param exerciseFilter filter to be edited */ public FilterViewModel(final ExerciseFilter exerciseFilter) { dateStart = new SimpleObjectProperty<>(exerciseFilter.getDateStart()); dateEnd = new SimpleObjectProperty<>(exerciseFilter.getDateEnd()); sportType = new SimpleObjectProperty<>(exerciseFilter.getSportType()); sportSubtype = new SimpleObjectProperty<>(exerciseFilter.getSportSubType()); intensity = new SimpleObjectProperty<>(new IntensityItem(exerciseFilter.getIntensity())); equipment = new SimpleObjectProperty<>(exerciseFilter.getEquipment()); commentSubString = new SimpleStringProperty( StringUtils.getTextOrEmptyString(exerciseFilter.getCommentSubString())); regularExpressionMode = new SimpleBooleanProperty(exerciseFilter.isRegularExpressionMode()); }