From 1caf0be10747b9ed01d432a9b5da7bfb9f72af9a Mon Sep 17 00:00:00 2001 From: Andreas Billmann Date: Tue, 24 Mar 2015 21:32:20 +0100 Subject: [PATCH] added attributes to UI --- .../java/de/geofroggerfx/ui/GeocachingIcons.java | 12 ------------ .../geofroggerfx/ui/details/DetailsController.java | 14 ++++++++++++++ .../de/geofroggerfx/dao/jdbc/updates/2.sql | 2 +- .../de/geofroggerfx/ui/details/details.fxml | 5 +---- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/java/de/geofroggerfx/ui/GeocachingIcons.java b/src/main/java/de/geofroggerfx/ui/GeocachingIcons.java index 4c604b6..315c543 100644 --- a/src/main/java/de/geofroggerfx/ui/GeocachingIcons.java +++ b/src/main/java/de/geofroggerfx/ui/GeocachingIcons.java @@ -189,18 +189,6 @@ public class GeocachingIcons { // attributeMap.put(GEOTOUR_FALSE(-67); } - public static Text getIconAsText(Attribute attribute, String iconSize) { - return createIcon(getIcon(attribute), iconSize); - } - - public static Text getIconAsText(Attribute attribute) { - return getIconAsText(attribute, GlyphIcon.DEFAULT_ICON_SIZE); - } - - public static String getIconAsString(Attribute attribute) { - return getIcon(attribute).characterToString(); - } - public static GlyphIcons getIcon(Attribute attribute) { GlyphIcons iconName = attributeMap.get(attribute); if (iconName == null) { diff --git a/src/main/java/de/geofroggerfx/ui/details/DetailsController.java b/src/main/java/de/geofroggerfx/ui/details/DetailsController.java index fcde0c4..1c242f3 100644 --- a/src/main/java/de/geofroggerfx/ui/details/DetailsController.java +++ b/src/main/java/de/geofroggerfx/ui/details/DetailsController.java @@ -30,11 +30,15 @@ import com.lynden.gmapsfx.MapComponentInitializedListener; import com.lynden.gmapsfx.javascript.object.*; import de.geofroggerfx.application.SessionContext; import de.geofroggerfx.application.SessionContextListener; +import de.geofroggerfx.model.Attribute; import de.geofroggerfx.model.Cache; import de.geofroggerfx.ui.FXMLController; +import de.geofroggerfx.ui.GeocachingIcons; +import de.geofroggerfx.ui.glyphs.GeofroggerGlyphsDude; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.control.TitledPane; +import javafx.scene.layout.FlowPane; import javafx.scene.layout.VBox; import javafx.scene.text.Text; import javafx.scene.web.WebEngine; @@ -47,7 +51,9 @@ import java.net.URL; import java.util.ResourceBundle; import static de.geofroggerfx.application.SessionContext.CURRENT_CACHE; +import static de.geofroggerfx.ui.GeocachingIcons.getIcon; import static de.geofroggerfx.ui.GeocachingIcons.getStarsAsString; +import static de.jensd.fx.glyphs.GlyphsDude.createIcon; /** * Created by Andreas on 09.03.2015. @@ -76,6 +82,9 @@ public class DetailsController extends FXMLController { @FXML private GoogleMapView mapView; + @FXML + private FlowPane attributeList; + private GoogleMap map; private Marker marker; @@ -142,6 +151,11 @@ public class DetailsController extends FXMLController { final WebEngine webEngine = this.description.getEngine(); webEngine.loadContent(description); + attributeList.getChildren().clear(); + for (Attribute attribute: cache.getAttributes()) { + attributeList.getChildren().add(createIcon(getIcon(attribute), "1.6em")); + } + LatLong latLong = new LatLong(cache.getMainWayPoint().getLatitude(), cache.getMainWayPoint().getLongitude()); MarkerOptions options = new MarkerOptions(); options.position(latLong); diff --git a/src/main/resources/de/geofroggerfx/dao/jdbc/updates/2.sql b/src/main/resources/de/geofroggerfx/dao/jdbc/updates/2.sql index 025e0d6..d88fbbe 100644 --- a/src/main/resources/de/geofroggerfx/dao/jdbc/updates/2.sql +++ b/src/main/resources/de/geofroggerfx/dao/jdbc/updates/2.sql @@ -5,4 +5,4 @@ CREATE TABLE attribute ( FOREIGN KEY(cache_id) REFERENCES cache(id) ON DELETE CASCADE ); -INSERT INTO version(version) values(2); \ No newline at end of file +UPDATE version SET version=2; \ No newline at end of file diff --git a/src/main/resources/de/geofroggerfx/ui/details/details.fxml b/src/main/resources/de/geofroggerfx/ui/details/details.fxml index fbc1c99..bf114d0 100644 --- a/src/main/resources/de/geofroggerfx/ui/details/details.fxml +++ b/src/main/resources/de/geofroggerfx/ui/details/details.fxml @@ -27,11 +27,8 @@ - + - - -