/** * Sets up the diagram for weight data. * * @param dataset the XY dataset to be filled * @param graphColors list of graph colors, can be filled with preferred colors */ private void setupWeightDiagram(TimeTableXYDataset dataset, java.util.List<java.awt.Color> graphColors) { // get time range to display TimeRangeType timeType = cbTimeRange.getValue(); int year = spYear.getValue(); addWeightTimeSeries(dataset, timeType, year); graphColors.add(new java.awt.Color(0xff0000)); }
/** * Sets up the diagram for sport subtype overview for the selected sport type. * * @param dataset the XY dataset to be filled * @param graphColors list of graph colors, can be filled with preferred colors */ private void setupSportSubTypeDiagram(TimeTableXYDataset dataset, java.util.List<java.awt.Color> graphColors) { // get time range to display TimeRangeType timeType = cbTimeRange.getValue(); int year = spYear.getValue(); // get selected sport type SportType sportType = cbSportTypeList.getValue(); // display a graph for each sport subtype for (SportSubType sportSubType : sportType.getSportSubTypeList()) { addSportSubTypeTimeSeries(dataset, timeType, year, sportType, sportSubType); } addCustomGraphColors(graphColors); }
/** * Sets up the diagram for exercise data. * * @param dataset the XY dataset to be filled * @param graphColors list of graph colors, can be filled with preferred colors */ private void setupExerciseDiagram(TimeTableXYDataset dataset, java.util.List<java.awt.Color> graphColors) { // get time range and value type to display TimeRangeType timeType = cbTimeRange.getValue(); int year = spYear.getValue(); ValueType vType = cbDisplay.getValue(); OverviewType overviewType = cbSportTypeMode.getValue(); // which sport type mode is selected by user ? if (overviewType != OverviewType.EACH_SPLITTED) { // create one graph for sum of all sport types addExerciseTimeSeries(dataset, timeType, year, vType, null); graphColors.add(new java.awt.Color(0xff0000)); } else { // create a separate graph for each sport type for (SportType sportType : document.getSportTypeList()) { addExerciseTimeSeries(dataset, timeType, year, vType, sportType); graphColors.add(ColorUtils.toAwtColor(sportType.getColor())); } } }
/** * Sets up the diagram for equipment usage for the selected sport type. * * @param dataset the XY dataset to be filled * @param graphColors list of graph colors, can be filled with preferred colors */ private void setupEquipmentDiagram(TimeTableXYDataset dataset, java.util.List<java.awt.Color> graphColors) { // get time range to display TimeRangeType timeType = cbTimeRange.getValue(); int year = spYear.getValue(); // get selected sport type SportType sportType = cbSportTypeList.getValue(); // display a graph for each equipment and one for not specified equipment for (Equipment equipment : sportType.getEquipmentList()) { addEquipmentTimeSeries(dataset, timeType, year, sportType, equipment); } addEquipmentTimeSeries(dataset, timeType, year, sportType, null); addCustomGraphColors(graphColors); }
/** * Fills all ChoiceBoxes with values dependent on the selected sport type. */ private void fillSportTypeDependentChoiceBoxes() { cbSportSubtype.getItems().clear(); cbEquipment.getItems().clear(); cbEquipment.getItems().add(equipmentNone); final SportType selectedSportType = cbSportType.getValue(); if (selectedSportType != null) { selectedSportType.getSportSubTypeList().forEach(sportSubType -> cbSportSubtype.getItems().add(sportSubType)); selectedSportType.getEquipmentList().forEach(equipment -> cbEquipment.getItems().add(equipment)); } // select equipment "none" when exercise contains no equipment if (exerciseViewModel.equipment.get() == null) { exerciseViewModel.equipment.set(equipmentNone); } // disable equipment ChoiceBox when no sport type selected cbEquipment.setDisable(selectedSportType == null); }
/** * Fills all ChoiceBoxes with values dependent on the selected sport type. */ private void fillSportTypeDependentChoiceBoxes() { cbSportSubtype.getItems().clear(); cbEquipment.getItems().clear(); cbSportSubtype.getItems().add(sportSubtypeAll); cbEquipment.getItems().add(equipmentAll); final SportType selectedSportType = cbSportType.getValue(); if (selectedSportType != null && !selectedSportType.equals(sportTypeAll)) { selectedSportType.getSportSubTypeList() .forEach(sportSubType -> cbSportSubtype.getItems().add(sportSubType)); selectedSportType.getEquipmentList().forEach(equipment -> cbEquipment.getItems().add(equipment)); } // select sport subtype and equipment "all" when the filter contains no sport subtype and equipment if (filterViewModel.sportSubtype.get() == null) { filterViewModel.sportSubtype.set(sportSubtypeAll); } if (filterViewModel.equipment.get() == null) { filterViewModel.equipment.set(equipmentAll); } }
private void updateOptionControls() { final ValueType selectedValueType = cbDisplay.getValue(); // the sport type mode selection must not be visible for the ValueType SPORTSUBTYPE, EQUIPMENT and WEIGHT final boolean sportTypeModeVisible = selectedValueType != ValueType.SPORTSUBTYPE && selectedValueType != ValueType.EQUIPMENT && selectedValueType != ValueType.WEIGHT; // the sport type list selection must only be visible for the ValueType SPORTSUBTYPE and EQUIPMENT final boolean sportTypeListVisible = selectedValueType == ValueType.SPORTSUBTYPE || selectedValueType == ValueType.EQUIPMENT; // add or remove sport type mode selection depending on visibility and current state if (sportTypeModeVisible && !hBoxOptions.getChildren().contains(hBoxSportTypeMode)) { hBoxOptions.getChildren().add(hBoxSportTypeMode); } if (!sportTypeModeVisible && hBoxOptions.getChildren().contains(hBoxSportTypeMode)) { hBoxOptions.getChildren().remove(hBoxSportTypeMode); } // add or remove sport type list selection depending on visibility and current state if (sportTypeListVisible && !hBoxOptions.getChildren().contains(hBoxSportTypeList)) { hBoxOptions.getChildren().add(hBoxSportTypeList); } if (!sportTypeListVisible && hBoxOptions.getChildren().contains(hBoxSportTypeList)) { hBoxOptions.getChildren().remove(hBoxSportTypeList); } }
TimeRangeType timeType = cbTimeRange.getValue(); ValueType vType = cbDisplay.getValue(); String valueTypeNameWithUnits = vType.getNameWithUnitSystem( context.getFormatUtils(), document.getOptions().getPreferredSpeedMode()); if (cbSportTypeMode.isVisible() && cbSportTypeMode.getValue() == OverviewType.EACH_STACKED) {