changed attributes to enum and did some performance optimazations with database access

This commit is contained in:
2014-08-29 00:39:27 +02:00
parent 714d10e379
commit 15e9ecb854
8 changed files with 370 additions and 92 deletions

View File

@@ -25,12 +25,11 @@
*/
package de.geofroggerfx.fx.cachedetails;
import de.geofroggerfx.application.SessionConstants;
import de.geofroggerfx.application.SessionContext;
import de.geofroggerfx.application.SessionContextListener;
import de.geofroggerfx.fx.components.MapPaneWrapper;
import de.geofroggerfx.fx.components.GeocachingIcons;
import de.geofroggerfx.fx.components.IconManager;
import de.geofroggerfx.fx.components.MapPaneWrapper;
import de.geofroggerfx.model.Cache;
import de.geofroggerfx.model.CacheList;
import de.geofroggerfx.service.CacheService;
@@ -117,12 +116,6 @@ public class CacheDetailsController implements Initializable, SessionContextList
@Inject
private CacheService cacheService;
/**
* Initializes the controller class.
*
* @param url
* @param rb
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
setSessionListener();

View File

@@ -25,7 +25,6 @@
*/
package de.geofroggerfx.fx.cachelist;
import de.geofroggerfx.application.SessionConstants;
import de.geofroggerfx.application.SessionContext;
import de.geofroggerfx.fx.components.CacheListCell;
import de.geofroggerfx.fx.components.IconManager;
@@ -35,14 +34,10 @@ import de.geofroggerfx.model.CacheList;
import de.geofroggerfx.service.CacheService;
import de.geofroggerfx.service.CacheSortField;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.scene.image.ImageView;
import javafx.util.Callback;
import org.scenicview.ScenicView;
import javax.inject.Inject;
import java.net.URL;
@@ -84,12 +79,6 @@ public class CacheListController implements Initializable {
@FXML
private ComboBox cacheListComboBox;
/**
* Initializes the controller class.
*
* @param url
* @param rb
*/
@Override
@SuppressWarnings("unchecked")
public void initialize(URL url, ResourceBundle rb) {
@@ -99,10 +88,10 @@ public class CacheListController implements Initializable {
setCellFactory();
cacheListView.getSelectionModel().selectedItemProperty().addListener(
(ChangeListener<Cache>) (ObservableValue<? extends Cache> ov, Cache oldValue, Cache newValue) ->
sessionContext.setData(CURRENT_CACHE, newValue)
observable -> sessionContext.setData(CURRENT_CACHE, cacheListView.getSelectionModel().getSelectedItem())
);
initCacheListComboBox();
initListMenuButton();
}
@@ -110,8 +99,8 @@ public class CacheListController implements Initializable {
@SuppressWarnings("unchecked")
private void setCellFactory() {
cacheListView.setCellFactory(
(Callback<ListView<Cache>, CacheListCell>)
(ListView<Cache> p) -> new CacheListCell());
param -> new CacheListCell()
);
}
private void setSessionListener() {

View File

@@ -26,8 +26,6 @@
package de.geofroggerfx.fx.components;
import de.geofroggerfx.fx.utils.JavaFXUtils;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.layout.Pane;
import jfxtras.labs.map.MapPane;
import jfxtras.labs.map.render.MapMarkable;
@@ -63,20 +61,14 @@ public class MapPaneWrapper extends Pane {
}
private void setSizeListener() {
this.widthProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
Double width = (Double) newValue;
mapPane.setMapWidth(width);
}
this.widthProperty().addListener((observable, oldValue, newValue) -> {
Double width = (Double) newValue;
mapPane.setMapWidth(width);
});
this.heightProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
Double height = (Double) newValue;
mapPane.setMapHeight(height);
}
this.heightProperty().addListener((observable, oldValue, newValue) -> {
Double height = (Double) newValue;
mapPane.setMapHeight(height);
});
}
}