kauron/estraba
Archived
1
0
Fork 0

Toggle is now toggleButton for time/distance

This commit is contained in:
Carlos Galindo 2016-05-25 17:08:11 +02:00
parent 5c6f8db4da
commit c3c48afcdc
Signed by: kauron
GPG key ID: 83E68706DEE119A3
2 changed files with 15 additions and 8 deletions

View file

@ -27,6 +27,7 @@ package es.kauron.estraba.controller;
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXSpinner; import com.jfoenix.controls.JFXSpinner;
import com.jfoenix.controls.JFXToggleButton;
import com.lynden.gmapsfx.GoogleMapView; import com.lynden.gmapsfx.GoogleMapView;
import com.lynden.gmapsfx.MapComponentInitializedListener; import com.lynden.gmapsfx.MapComponentInitializedListener;
import com.lynden.gmapsfx.javascript.object.*; import com.lynden.gmapsfx.javascript.object.*;
@ -45,7 +46,6 @@ import javafx.scene.Scene;
import javafx.scene.chart.AreaChart; import javafx.scene.chart.AreaChart;
import javafx.scene.chart.LineChart; import javafx.scene.chart.LineChart;
import javafx.scene.chart.PieChart; import javafx.scene.chart.PieChart;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.Tab; import javafx.scene.control.Tab;
import javafx.scene.image.Image; import javafx.scene.image.Image;
@ -102,7 +102,7 @@ public class DashboardController implements Initializable, MapComponentInitializ
private LineChart<Long, Double> speedTChart, hrTChart, cadenceTChart; private LineChart<Long, Double> speedTChart, hrTChart, cadenceTChart;
@FXML @FXML
private ChoiceBox<String> choiceBox; private JFXToggleButton toggleCharts;
@FXML @FXML
private StackPane charts; private StackPane charts;
@ -124,10 +124,7 @@ public class DashboardController implements Initializable, MapComponentInitializ
imgDistance.setImage(new Image(App.class.getResourceAsStream("img/distance.png"))); imgDistance.setImage(new Image(App.class.getResourceAsStream("img/distance.png")));
imgElevation.setImage(new Image(App.class.getResourceAsStream("img/elevation.png"))); imgElevation.setImage(new Image(App.class.getResourceAsStream("img/elevation.png")));
choiceBox.getItems().add(App.GENERAL_BUNDLE.getString("label.distance")); toggleCharts.selectedProperty().addListener((observableValue, s, t1) -> {
choiceBox.getItems().add(App.GENERAL_BUNDLE.getString("label.time"));
choiceBox.setValue(choiceBox.getItems().get(0));
choiceBox.valueProperty().addListener((observableValue, s, t1) -> {
for (Node n : charts.getChildrenUnmodifiable()) for (Node n : charts.getChildrenUnmodifiable())
n.setVisible(!n.isVisible()); n.setVisible(!n.isVisible());
}); });

View file

@ -28,6 +28,7 @@
<?import com.jfoenix.controls.JFXButton?> <?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXSpinner?> <?import com.jfoenix.controls.JFXSpinner?>
<?import com.jfoenix.controls.JFXTabPane?> <?import com.jfoenix.controls.JFXTabPane?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import com.lynden.gmapsfx.GoogleMapView?> <?import com.lynden.gmapsfx.GoogleMapView?>
<?import java.lang.String?> <?import java.lang.String?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
@ -35,7 +36,6 @@
<?import javafx.scene.chart.LineChart?> <?import javafx.scene.chart.LineChart?>
<?import javafx.scene.chart.NumberAxis?> <?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.chart.PieChart?> <?import javafx.scene.chart.PieChart?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.Tab?> <?import javafx.scene.control.Tab?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
@ -425,7 +425,17 @@
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
<ChoiceBox fx:id="choiceBox" prefWidth="150.0" /> <HBox alignment="CENTER" spacing="5.0">
<children>
<Label text="%label.distance" />
<JFXToggleButton fx:id="toggleCharts" unToggleColor="#fc4c02" unToggleLineColor="#ffba9e">
<padding>
<Insets bottom="-5.0" left="-5.0" right="-5.0" top="-5.0" />
</padding>
</JFXToggleButton>
<Label text="%label.time" />
</children>
</HBox>
<StackPane fx:id="charts"> <StackPane fx:id="charts">
<children> <children>
<VBox> <VBox>