add log handling
This commit is contained in:
@@ -32,13 +32,22 @@ import de.geofroggerfx.application.SessionContext;
|
|||||||
import de.geofroggerfx.application.SessionContextListener;
|
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.ui.FXMLController;
|
import de.geofroggerfx.ui.FXMLController;
|
||||||
import de.geofroggerfx.ui.GeocachingIcons;
|
import de.geofroggerfx.ui.GeocachingIcons;
|
||||||
import de.geofroggerfx.ui.glyphs.GeofroggerGlyphsDude;
|
import de.geofroggerfx.ui.glyphs.GeofroggerGlyphsDude;
|
||||||
|
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
|
||||||
|
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcons;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Label;
|
import javafx.geometry.HPos;
|
||||||
import javafx.scene.control.TitledPane;
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.geometry.VPos;
|
||||||
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.FlowPane;
|
import javafx.scene.layout.FlowPane;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.scene.layout.Region;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import javafx.scene.web.WebEngine;
|
import javafx.scene.web.WebEngine;
|
||||||
@@ -85,6 +94,12 @@ public class DetailsController extends FXMLController {
|
|||||||
@FXML
|
@FXML
|
||||||
private FlowPane attributeList;
|
private FlowPane attributeList;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private GridPane logList;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private FlowPane logButtonPane;
|
||||||
|
|
||||||
private GoogleMap map;
|
private GoogleMap map;
|
||||||
private Marker marker;
|
private Marker marker;
|
||||||
|
|
||||||
@@ -97,13 +112,21 @@ public class DetailsController extends FXMLController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
|
setCacheListener();
|
||||||
|
initializeMap();
|
||||||
|
setLogLinkButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCacheListener() {
|
||||||
sessionContext.addListener(CURRENT_CACHE, new SessionContextListener() {
|
sessionContext.addListener(CURRENT_CACHE, new SessionContextListener() {
|
||||||
@Override
|
@Override
|
||||||
public void sessionContextChanged() {
|
public void sessionContextChanged() {
|
||||||
fillContent();
|
fillContent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeMap() {
|
||||||
mapView.addMapInializedListener(new MapComponentInitializedListener() {
|
mapView.addMapInializedListener(new MapComponentInitializedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void mapInitialized() {
|
public void mapInitialized() {
|
||||||
@@ -131,6 +154,26 @@ public class DetailsController extends FXMLController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setLogLinkButton() {
|
||||||
|
Button logLink = GeofroggerGlyphsDude.createIconButton(FontAwesomeIcons.EXTERNAL_LINK);
|
||||||
|
logLink.setStyle("-fx-background-color: transparent;");
|
||||||
|
logButtonPane.getChildren().add(logLink);
|
||||||
|
logLink.setOnAction(event -> {
|
||||||
|
Cache cache = (Cache) sessionContext.getData(CURRENT_CACHE);
|
||||||
|
if (cache != null) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (Log log: cache.getLogs()) {
|
||||||
|
sb.append(log.getText());
|
||||||
|
sb.append("\n--------------------------------------\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
Alert logWindow = new Alert(Alert.AlertType.INFORMATION);
|
||||||
|
logWindow.setContentText(sb.toString());
|
||||||
|
logWindow.showAndWait();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void fillContent() {
|
private void fillContent() {
|
||||||
Cache cache = (Cache) sessionContext.getData(CURRENT_CACHE);
|
Cache cache = (Cache) sessionContext.getData(CURRENT_CACHE);
|
||||||
cacheName.setText(cache.getName());
|
cacheName.setText(cache.getName());
|
||||||
@@ -156,6 +199,13 @@ public class DetailsController extends FXMLController {
|
|||||||
attributeList.getChildren().add(createIcon(getIcon(attribute), "1.6em"));
|
attributeList.getChildren().add(createIcon(getIcon(attribute), "1.6em"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logList.getChildren().clear();
|
||||||
|
int maxRow = Math.min(4, cache.getLogs().size());
|
||||||
|
for (int row=0; row<maxRow; row++) {
|
||||||
|
setLogIcon(row);
|
||||||
|
setLogText(row, cache.getLogs().get(row));
|
||||||
|
}
|
||||||
|
|
||||||
LatLong latLong = new LatLong(cache.getMainWayPoint().getLatitude(), cache.getMainWayPoint().getLongitude());
|
LatLong latLong = new LatLong(cache.getMainWayPoint().getLatitude(), cache.getMainWayPoint().getLongitude());
|
||||||
MarkerOptions options = new MarkerOptions();
|
MarkerOptions options = new MarkerOptions();
|
||||||
options.position(latLong);
|
options.position(latLong);
|
||||||
@@ -169,4 +219,20 @@ public class DetailsController extends FXMLController {
|
|||||||
map.setCenter(latLong);
|
map.setCenter(latLong);
|
||||||
mapView.requestLayout();
|
mapView.requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setLogIcon(int row) {
|
||||||
|
logList.add(GeofroggerGlyphsDude.createIcon(FontAwesomeIcons.CHECK), 0, row);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setLogText(int row, Log log) {
|
||||||
|
Label logLabel = new Label(log.getText());
|
||||||
|
logLabel.setWrapText(false);
|
||||||
|
logLabel.setTextOverrun(OverrunStyle.ELLIPSIS);
|
||||||
|
logLabel.setAlignment(Pos.TOP_LEFT);
|
||||||
|
logLabel.setMaxHeight(Region.USE_PREF_SIZE);
|
||||||
|
logLabel.setPrefHeight(18.0);
|
||||||
|
logLabel.setMinHeight(Region.USE_PREF_SIZE);
|
||||||
|
logLabel.setTooltip(new Tooltip(log.getText()));
|
||||||
|
logList.add(logLabel, 1, row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,23 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.scene.web.*?>
|
|
||||||
<?import javafx.scene.image.*?>
|
|
||||||
<?import javafx.scene.text.*?>
|
<?import javafx.scene.text.*?>
|
||||||
|
<?import com.lynden.gmapsfx.*?>
|
||||||
<?import de.jensd.fx.glyphs.fontawesome.*?>
|
<?import de.jensd.fx.glyphs.fontawesome.*?>
|
||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import java.net.*?>
|
<?import java.net.*?>
|
||||||
<?import javafx.geometry.*?>
|
<?import javafx.geometry.*?>
|
||||||
<?import javafx.scene.effect.*?>
|
<?import javafx.scene.effect.*?>
|
||||||
|
<?import javafx.scene.web.*?>
|
||||||
|
<?import com.lynden.gmapsfx.GoogleMapView?>
|
||||||
|
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.effect.DropShadow?>
|
<?import javafx.scene.effect.DropShadow?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.web.WebView?>
|
||||||
<?import javafx.scene.text.Text?>
|
|
||||||
<?import java.net.URL?>
|
<?import java.net.URL?>
|
||||||
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon?>
|
|
||||||
|
|
||||||
<?import com.lynden.gmapsfx.GoogleMapView?>
|
<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">
|
||||||
<?import de.geofroggerfx.ui.glyphs.ElusiveIcon?>
|
|
||||||
<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">
|
|
||||||
<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>
|
||||||
@@ -30,8 +25,6 @@
|
|||||||
<content>
|
<content>
|
||||||
<FlowPane fx:id="attributeList" hgap="4.0" prefWidth="200.0" vgap="4.0">
|
<FlowPane fx:id="attributeList" hgap="4.0" prefWidth="200.0" vgap="4.0">
|
||||||
<children>
|
<children>
|
||||||
<!--<FontAwesomeIcon glyphName="CAR" size="1.6em"/>-->
|
|
||||||
<!--<ElusiveIcon glyphName="YOUTUBE" size="1.6em"/>-->
|
|
||||||
</children>
|
</children>
|
||||||
<opaqueInsets>
|
<opaqueInsets>
|
||||||
<Insets />
|
<Insets />
|
||||||
@@ -41,35 +34,18 @@
|
|||||||
</TitledPane>
|
</TitledPane>
|
||||||
<TitledPane animated="false" collapsible="false" text="Logs">
|
<TitledPane animated="false" collapsible="false" text="Logs">
|
||||||
<content>
|
<content>
|
||||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
<AnchorPane>
|
||||||
<children>
|
<children>
|
||||||
<GridPane hgap="4.0" vgap="4.0" AnchorPane.bottomAnchor="0.0"
|
<GridPane fx:id="logList" hgap="4.0" vgap="4.0" AnchorPane.bottomAnchor="28.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
|
||||||
AnchorPane.topAnchor="0.0">
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="NEVER" minWidth="10.0" />
|
<ColumnConstraints hgrow="NEVER" minWidth="10.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" vgrow="NEVER"/>
|
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
|
||||||
<FontAwesomeIcon glyphName="EXTERNAL_LINK" size="1.2em" GridPane.columnIndex="1"
|
|
||||||
GridPane.halignment="RIGHT" GridPane.rowIndex="2"
|
|
||||||
GridPane.valignment="BOTTOM"/>
|
|
||||||
<Label alignment="TOP_LEFT"
|
|
||||||
text="Bei einer Spontan-Tour mit den Hoppels haben wir heute nun zum 2. Mal den Geisterkäfer besucht.Immer wieder nett [;)]. Die Zeit hinterlässt immer mehr ihre Spuren.Nach kurzer Suche war das Final gefunden und der Rest schnell erledigt.Auch wir danken für's reloaden [8D].Viele Grüße - die Jedi-Ritter"
|
|
||||||
wrapText="true" GridPane.columnIndex="1"/>
|
|
||||||
<FontAwesomeIcon glyphName="CHECK" size="1.2em" GridPane.valignment="TOP"/>
|
|
||||||
<FontAwesomeIcon glyphName="TIMES" size="1.2em" GridPane.rowIndex="1"
|
|
||||||
GridPane.valignment="TOP"/>
|
|
||||||
<Label alignment="TOP_LEFT"
|
|
||||||
text="Hier war ich doch schon mal...Nach einer gefühlten Ewigkeit die Dose dann doch noch gefunden.DFDC"
|
|
||||||
wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
<FlowPane fx:id="logButtonPane" alignment="BOTTOM_RIGHT" columnHalignment="RIGHT" layoutX="-10.0" layoutY="-23.0" maxHeight="-Infinity" minHeight="-Infinity" prefHeight="28.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</content>
|
</content>
|
||||||
@@ -106,21 +82,16 @@
|
|||||||
<children>
|
<children>
|
||||||
<Label fx:id="cacheName" styleClass="cache-h1" text="Cache-Name" GridPane.columnSpan="4" />
|
<Label fx:id="cacheName" styleClass="cache-h1" text="Cache-Name" GridPane.columnSpan="4" />
|
||||||
<Label text="Difficulty:" GridPane.rowIndex="1" />
|
<Label text="Difficulty:" GridPane.rowIndex="1" />
|
||||||
<FontAwesomeIcon fx:id="cacheDifficulty" glyphName="BLANK"
|
<FontAwesomeIcon fx:id="cacheDifficulty" glyphName="BLANK" glyphStyle="-fx-fill: linear-gradient(#e8e474 0%, #edcf59 70%, #bfba26 85%);" size="16.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||||
glyphStyle="-fx-fill: linear-gradient(#e8e474 0%, #edcf59 70%, #bfba26 85%);"
|
|
||||||
size="16.0" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
|
||||||
<Label text="Terrain:" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
<Label text="Terrain:" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
||||||
<FontAwesomeIcon fx:id="cacheTerrain" glyphName="BLANK"
|
<FontAwesomeIcon fx:id="cacheTerrain" glyphName="BLANK" glyphStyle="-fx-fill: linear-gradient(#e8e474 0%, #edcf59 70%, #bfba26 85%);" size="16.0" GridPane.columnIndex="3" GridPane.rowIndex="1" />
|
||||||
glyphStyle="-fx-fill: linear-gradient(#e8e474 0%, #edcf59 70%, #bfba26 85%);"
|
|
||||||
size="16.0" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
|
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</top>
|
</top>
|
||||||
<center>
|
<center>
|
||||||
<ScrollPane fitToHeight="true" fitToWidth="true" minWidth="400.0" prefHeight="200.0" prefWidth="400.0"
|
<ScrollPane fitToHeight="true" fitToWidth="true" minWidth="400.0" prefHeight="200.0" prefWidth="400.0" style="-fx-background-color: #ffffff;" BorderPane.alignment="CENTER">
|
||||||
style="-fx-background-color: #ffffff;" BorderPane.alignment="CENTER">
|
|
||||||
<content>
|
<content>
|
||||||
<VBox fx:id="mainContent" style="-fx-background-color: #ffffff;" spacing="10">
|
<VBox fx:id="mainContent" spacing="10" style="-fx-background-color: #ffffff;">
|
||||||
<children>
|
<children>
|
||||||
<WebView fx:id="description" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
|
<WebView fx:id="description" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
Reference in New Issue
Block a user