only show details pane, when cache is selected
This commit is contained in:
@@ -26,10 +26,8 @@
|
|||||||
package de.geofroggerfx.ui.details;
|
package de.geofroggerfx.ui.details;
|
||||||
|
|
||||||
import com.lynden.gmapsfx.GoogleMapView;
|
import com.lynden.gmapsfx.GoogleMapView;
|
||||||
import com.lynden.gmapsfx.MapComponentInitializedListener;
|
|
||||||
import com.lynden.gmapsfx.javascript.object.*;
|
import com.lynden.gmapsfx.javascript.object.*;
|
||||||
import de.geofroggerfx.application.SessionContext;
|
import de.geofroggerfx.application.SessionContext;
|
||||||
import de.geofroggerfx.application.SessionContextListener;
|
|
||||||
import de.geofroggerfx.model.Attribute;
|
import de.geofroggerfx.model.Attribute;
|
||||||
import de.geofroggerfx.model.Cache;
|
import de.geofroggerfx.model.Cache;
|
||||||
import de.geofroggerfx.model.Log;
|
import de.geofroggerfx.model.Log;
|
||||||
@@ -68,6 +66,9 @@ public class DetailsController extends FXMLController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SessionContext sessionContext;
|
private SessionContext sessionContext;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private BorderPane detailsPane;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label cacheName;
|
private Label cacheName;
|
||||||
|
|
||||||
@@ -107,24 +108,18 @@ public class DetailsController extends FXMLController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
detailsPane.setVisible(false);
|
||||||
setCacheListener();
|
setCacheListener();
|
||||||
initializeMap();
|
initializeMap();
|
||||||
setLogLinkButton();
|
setLogLinkButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCacheListener() {
|
private void setCacheListener() {
|
||||||
sessionContext.addListener(CURRENT_CACHE, new SessionContextListener() {
|
sessionContext.addListener(CURRENT_CACHE, () -> fillContent());
|
||||||
@Override
|
|
||||||
public void sessionContextChanged() {
|
|
||||||
fillContent();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeMap() {
|
private void initializeMap() {
|
||||||
mapView.addMapInializedListener(new MapComponentInitializedListener() {
|
mapView.addMapInializedListener(() -> {
|
||||||
@Override
|
|
||||||
public void mapInitialized() {
|
|
||||||
//Set the initial properties of the map.
|
//Set the initial properties of the map.
|
||||||
MapOptions mapOptions = new MapOptions();
|
MapOptions mapOptions = new MapOptions();
|
||||||
mapOptions.center(new LatLong(47.6097, -122.3331))
|
mapOptions.center(new LatLong(47.6097, -122.3331))
|
||||||
@@ -145,7 +140,6 @@ public class DetailsController extends FXMLController {
|
|||||||
marker = new Marker(options);
|
marker = new Marker(options);
|
||||||
map.addMarker(marker);
|
map.addMarker(marker);
|
||||||
map.setCenter(latLong);
|
map.setCenter(latLong);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,6 +226,9 @@ public class DetailsController extends FXMLController {
|
|||||||
|
|
||||||
private void fillContent() {
|
private void fillContent() {
|
||||||
Cache cache = (Cache) sessionContext.getData(CURRENT_CACHE);
|
Cache cache = (Cache) sessionContext.getData(CURRENT_CACHE);
|
||||||
|
|
||||||
|
if (cache != null) {
|
||||||
|
detailsPane.setVisible(true);
|
||||||
cacheName.setText(cache.getName());
|
cacheName.setText(cache.getName());
|
||||||
cacheDifficulty.setText(getStarsAsString(cache.getDifficulty()));
|
cacheDifficulty.setText(getStarsAsString(cache.getDifficulty()));
|
||||||
cacheTerrain.setText(getStarsAsString(cache.getTerrain()));
|
cacheTerrain.setText(getStarsAsString(cache.getTerrain()));
|
||||||
@@ -274,6 +271,9 @@ public class DetailsController extends FXMLController {
|
|||||||
map.addMarker(marker);
|
map.addMarker(marker);
|
||||||
map.setCenter(latLong);
|
map.setCenter(latLong);
|
||||||
mapView.requestLayout();
|
mapView.requestLayout();
|
||||||
|
} else {
|
||||||
|
detailsPane.setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLogIcon(int row) {
|
private void setLogIcon(int row) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<?import javafx.scene.web.WebView?>
|
<?import javafx.scene.web.WebView?>
|
||||||
<?import java.net.URL?>
|
<?import java.net.URL?>
|
||||||
<BorderPane layoutX="10.0" layoutY="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="600" minWidth="400" style="-fx-background-color: #ffffff;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
<BorderPane fx:id="detailsPane" layoutX="10.0" layoutY="10.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="600" minWidth="400" style="-fx-background-color: #ffffff;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<right>
|
<right>
|
||||||
<VBox minWidth="200.0" prefHeight="200.0" spacing="8.0" BorderPane.alignment="CENTER">
|
<VBox minWidth="200.0" prefHeight="200.0" spacing="8.0" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
|
|||||||
Reference in New Issue
Block a user