Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2 #116

Open
wants to merge 350 commits into
base: 8.0
Choose a base branch
from
Open

2.2 #116

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
350 commits
Select commit Hold shift + click to select a range
2cdf849
moved enum for zoom boundaries
Apr 30, 2013
a8f4579
The environment variable JAVA_HOME must be set to jre/lib/jfxrt.jar
hameister Apr 30, 2013
9a08c53
Merge pull request #36 from hameister/patch-2
tbee Apr 30, 2013
5b6a183
removed support for google maps because of license issue
May 2, 2013
204ed67
Change mouse handler to achieve smooth map dragging experience
gorskima May 2, 2013
adf417b
extracted method
May 3, 2013
85ef0b1
updated javadoc & removed translate of clip mask
May 3, 2013
2165cbd
Merge pull request #2 from gorskima/smooth-move
May 3, 2013
909ca9d
Merge branch '2.2' of https://github.com/Mario-S/jfxtras-labs.git int…
mario-s May 3, 2013
1b60a30
some clean ups
May 3, 2013
592efa5
Merge pull request #37 from Mario-S/2.2
May 3, 2013
563bf4c
extracted tile rendering methods into new class
May 3, 2013
6b12256
Merge pull request #38 from Mario-S/2.2
May 3, 2013
144ba5a
added a refresh to ListView
tbee May 5, 2013
560d241
encoding woos patch
tbee May 5, 2013
e0ca4f1
improved version of the refresh patch
tbee May 5, 2013
128cfa3
added a fix when map is moved to the edges of the window, still needs…
May 7, 2013
5a0b71b
updated javadoc
May 7, 2013
fde807c
Merge pull request #39 from Mario-S/2.2
May 7, 2013
828120b
simplified loading of tiles: removed check for start_top/ start_left
May 7, 2013
d3773dd
some javadoc
tbee May 11, 2013
7437faa
Issue #40 : Added date formatting support to the BeanPathAdapter
ugate May 11, 2013
d3ef2aa
Fixed problems with NPE when value or format is null
teabeeoh May 19, 2013
03e018c
Fixed incorrect behavior when calling requestFocus() on BigDecimalField
teabeeoh May 19, 2013
499eb5b
CalendarLabel, Label that displays a Calendar and reacts on changes of
teabeeoh May 19, 2013
d50a07f
improve focus handling
tbee May 20, 2013
3d32af5
removed the showTime property from CalendarTextField
tbee May 20, 2013
706ce79
adding dateFormat and dateFormats to CalendarTimeTextField
tbee May 20, 2013
c82d5af
optimizablecontentpane added:
miho May 21, 2013
bca8da6
optimizablecontentpane added:
miho May 21, 2013
56e3a8b
2.2-r5
tbee May 21, 2013
0d04191
JSR310 additions
tbee May 20, 2013
9529dbe
Merge branch '2.2' of https://github.com/JFXtras/jfxtras-labs.git int…
mario-s May 23, 2013
60e2c68
splitted interface
May 24, 2013
605ceda
Merge pull request #42 from Mario-S/2.2
May 24, 2013
4b2d7cf
formated some methods
May 28, 2013
0280c69
formated method
May 29, 2013
71df524
Merge branch '2.2' of https://github.com/JFXtras/jfxtras-labs.git int…
mario-s Jun 3, 2013
f18731c
changed order of rendering in tile renderer to fix grid
Jun 13, 2013
213f31d
Merge pull request #43 from Mario-S/2.2
Jun 13, 2013
a0e7dc7
moved field lastDargPoint to mouse handler
Jun 13, 2013
1dad9eb
removed useless mouse event handler
Jun 13, 2013
43e3817
Merge pull request #44 from Mario-S/2.2
Jun 13, 2013
a5a9bc6
changed constructor to use different interface
Jun 13, 2013
2ec7489
removed ignoreRepaint field
Jun 14, 2013
b54ab48
Merge pull request #45 from Mario-S/2.2
Jun 14, 2013
5c7e525
Create MonologFXButton_fr_FR.properties
deamn Jun 18, 2013
c2b8fe4
Create MonologFXButton_it_IT.properties
deamn Jun 18, 2013
19146b1
Merge pull request #46 from deamn/2.2
mkheck Jun 18, 2013
c0e254b
experimental centering of map
mario-s Jun 20, 2013
5809937
centered when zooming out with scroll wheel
mario-s Jul 1, 2013
3237653
moved method to centre the map and added check if the map is within t…
mario-s Jul 2, 2013
86dc242
parse alternates before the default
tbee Jul 3, 2013
6d81d26
Merge branch '2.2' of https://github.com/JFXtras/jfxtras-labs.git int…
mario-s Jul 5, 2013
ce395ca
changed interface and implementation for tile renderer added new meth…
mario-s Jul 5, 2013
d7475ab
-made suboptimal bounds listener optional (disabled now by default)
miho Aug 5, 2013
9b1e688
added mockito dependencies
Aug 11, 2013
423e240
centered when any edge is visible during zoom out
Aug 11, 2013
845aae8
moving not enabled when map is within window
Aug 11, 2013
874271b
map is now centered only when all edges all visible during zoom out
Aug 12, 2013
82dee26
changed initial zoom state
Aug 12, 2013
92e33ea
Aug 13, 2013
d192923
clean up of imports and small refactoring in MapPane
mario-s Aug 13, 2013
225cd64
moved arrow and alignment properties to the skin and made them stylea…
tbee Aug 15, 2013
81bca8c
ScalableContentPane supports min/max scale properties
miho Aug 15, 2013
95f0260
Merge branch '2.2' of github.com:JFXtras/jfxtras-labs into 2.2
miho Aug 15, 2013
8ac9f3b
minor improvements
tbee Aug 15, 2013
f5d7615
Merge branch '2.2' of https://github.com/JFXtras/jfxtras-labs into 2.2
tbee Aug 15, 2013
c01c712
fixing a weird compilation problem
tbee Aug 15, 2013
83af105
fixed an issue with timer threads not being released
tbee Aug 16, 2013
e1fbd55
added fxml sample
Aug 16, 2013
8947ecf
finishing up making value-alignment also styleable
tbee Aug 16, 2013
0defb06
Initial commit of files for Magnifier control.
SaiPradeepDandem Aug 16, 2013
ae2a5ed
extracted component for zoom control
Aug 16, 2013
dc1fabe
changed demo to use fxml & updated css
mario-s Aug 17, 2013
84e8372
renamed interfaces and further cleanup in pane
mario-s Aug 17, 2013
9def4e2
addedbutton to center the map
mario-s Aug 18, 2013
aa201fd
changed icon, renamed method 6 refactored the factory
mario-s Aug 18, 2013
f13dbb1
Merge pull request #53 from Mario-S/2.2
mario-s Aug 18, 2013
4b00e13
Added changes to replace ChangeListeners with InvalidationListeners.
SaiPradeepDandem Aug 19, 2013
78d0186
further clean up in MapPane & added a simple check to avoid that the …
mario-s Aug 20, 2013
d38fbf8
fixed test
mario-s Aug 20, 2013
d526251
Merge pull request #54 from Mario-S/2.2
mario-s Aug 20, 2013
840ea8d
Merge pull request #52 from SaiPradeepDandem/2.2
SaiPradeepDandem Aug 20, 2013
e98594b
initial of force reload feature
Aug 22, 2013
6f0a39d
moved getter & setter for TileSource to another interface
Aug 23, 2013
0c76989
finishing up
tbee Aug 24, 2013
e8543ff
extended BuilderFactory
tbee Aug 24, 2013
e50d426
simplifications
tbee Aug 25, 2013
fd74239
javadoc, fine tuning
tbee Aug 25, 2013
363fefd
extracted tile load commands
Aug 26, 2013
768f9cc
reorganized packages
Aug 26, 2013
74c5e6a
refresh feature in progress
Aug 27, 2013
5347337
removed old files
Aug 27, 2013
6182120
reduced minimum width & disabled air space in trial
Aug 27, 2013
87fc001
Merge pull request #55 from Mario-S/2.2
mario-s Aug 27, 2013
33599c0
added button to refresh
mario-s Aug 27, 2013
8353ace
implemented refesh in MapPane
Aug 28, 2013
6d08708
Minor changes to replace mask implementation.
SaiPradeepDandem Aug 28, 2013
c4f1cb6
Copied the canned animations from JideFX over the JFXtras (with permi…
tbee Aug 28, 2013
91a83b6
Merge branch '2.2' of https://github.com/JFXtras/jfxtras-labs into 2.2
tbee Aug 28, 2013
d03e139
added icon for refresh button
Aug 29, 2013
4a8defb
added image
Aug 29, 2013
438853e
resolved conflict
Aug 29, 2013
a9a2cfd
Added copyright information to the Magnifier control related files.
SaiPradeepDandem Aug 29, 2013
482862b
Merge pull request #57 from SaiPradeepDandem/2.2
SaiPradeepDandem Aug 29, 2013
4415353
disabled check if map can be moved
mario-s Aug 29, 2013
9663f1b
Merge pull request #58 from Mario-S/2.2
mario-s Aug 29, 2013
6ee985b
prepared experimental repairHeaders task
miho Sep 2, 2013
46f9d94
prepared experimental repairHeaders task
miho Sep 2, 2013
8cf0f47
Merge branch '2.2' of github.com:JFXtras/jfxtras-labs into 2.2
miho Sep 2, 2013
d4f6da2
license template updated. uses new year variable:
miho Sep 3, 2013
c94a343
repaired the license headers
tbee Sep 3, 2013
9d10c42
Merge branch '2.2' of https://github.com/JFXtras/jfxtras-labs into 2.2
tbee Sep 3, 2013
ea9f7ae
Fix for issue #61: https://github.com/JFXtras/jfxtras-labs/issues/61
miho Sep 3, 2013
33994b1
conflict in build.gradle resolved
miho Sep 3, 2013
9bbf302
locale handling fixes
tbee Sep 6, 2013
973f52e
getUserAgentStylesheet() must use this.getClass().getResource(...)
tbee Sep 6, 2013
da660b4
Update README.md
mibamur Sep 10, 2013
517597f
Update README.md
mibamur Sep 10, 2013
6cec7f7
Merge pull request #62 from mibamur/2.2
tbee Sep 10, 2013
52efd0c
fixed checking of map edge by modifying the comparator
mario-s Sep 15, 2013
2210ef8
added copyright
mario-s Sep 15, 2013
c209e25
fixing maven deploy
tbee Sep 15, 2013
b78d42d
renamed comparator class
mario-s Sep 16, 2013
a12a1b7
Merge pull request #64 from Mario-S/2.2
mario-s Sep 16, 2013
2de20fe
travis.yml added in order to introduce introduce ci
McFoggy Sep 18, 2013
0048e10
instrument .travis.yml file so that the build envrionment is not head…
McFoggy Sep 18, 2013
6ab4e60
changing TERM property to have clean output in travis logs
McFoggy Sep 18, 2013
bedaaca
enhance travis build for better log
McFoggy Sep 18, 2013
74fba9c
simplification travis build file, show some info and tests logs failu…
McFoggy Sep 18, 2013
3218a7a
Merge pull request #65 from McFoggy/2.2
McFoggy Sep 22, 2013
7cff5ea
add travis-ci badge to Readme.md
McFoggy Sep 23, 2013
0737835
Pressing arrow keys on BigDecimalField should repeat increment/decrem…
ricemery Sep 27, 2013
fdc5b59
Revert "Pressing arrow keys on BigDecimalField should repeat incremen…
ricemery Sep 27, 2013
30cf64a
Pressing arrow keys on BigDecimalField should repeat increment/decrem…
ricemery Sep 27, 2013
2a03150
Added delay of 500ms and reduced click rate to 50s to repeated mouse
teabeeoh Sep 30, 2013
37df228
Added option to enable/disable deselect for date picker
mbulthuis Oct 15, 2013
24b0881
SFW-20978 added disable/enable deselect mode in datepicker, disabled …
mbulthuis Oct 15, 2013
1fd583c
Merge pull request #68 from mbulthuis/2.2
tbee Oct 15, 2013
59d4db2
minor things
tbee Oct 18, 2013
d26447a
+allowNull
tbee Oct 21, 2013
96d7517
minor fix
tbee Oct 24, 2013
2f41bba
react better to changes in locale
tbee Oct 24, 2013
67c4578
better handle locale switching
tbee Oct 24, 2013
25069d3
+disabledCalendars
tbee Oct 25, 2013
0b893d2
+highlightedCalendars
tbee Oct 25, 2013
bffc540
changed highlighed / disabled API to match Agenda's
tbee Oct 26, 2013
3d2968b
added styles for zoom buttons
Oct 26, 2013
584ac91
new simple sample
Oct 27, 2013
16a5cc0
Ability to hide the weeknumers (-fxx-show-weeknumbers:NO;)
tbee Oct 27, 2013
b1bf7a8
removed useless listener
Oct 27, 2013
cdcfa45
removed useless listener
Oct 27, 2013
c9dbae3
finished TODO
Oct 27, 2013
cb32f20
fixes
tbee Oct 27, 2013
b2a44bc
react to changes in disabled or highlighted calendars
tbee Oct 28, 2013
1e5f604
new styles for buttons when images are displayed
Oct 28, 2013
b7c9cac
removed call to getMapX and getMapY, since it will always return zero
Oct 30, 2013
f77485d
added fix to avoid that zoom method is been called twice
Oct 31, 2013
e8ebfcb
working on zoom problem
Nov 1, 2013
cd1fd93
changed trial
Nov 1, 2013
e4bc8b3
added workaround for zoom out of place
Nov 1, 2013
f091de3
extended test for local tile source
Nov 2, 2013
b477d9b
changed local tiles, removed loading of error image
Nov 3, 2013
a8e6f00
removed error image
Nov 4, 2013
ebdb11e
removed unused import
Nov 4, 2013
64e3382
fixed test
Nov 4, 2013
b884da0
Merge pull request #71 from Mario-S/2.2
mario-s Nov 4, 2013
110943b
changed package for test
Nov 4, 2013
120efff
added workaround to run more than one Jemmy test during the build
Nov 5, 2013
7493a53
added check if it is headless
Nov 6, 2013
b064eb7
always return true
Nov 6, 2013
463fd4c
uncommented test code to find invoking of jemmy
Nov 6, 2013
602cf5c
disabled test code to find invoking of display
Nov 6, 2013
d2baae6
disabled test code to find invoking of display
Nov 6, 2013
e33c665
disabled test code to find invoking of display
Nov 6, 2013
df067bb
added check if it is headless
Nov 6, 2013
b622ba5
extracted method to store start zoom coordinate
Nov 9, 2013
cbfb57b
private class for zoom coordinate
Nov 9, 2013
46d8d98
number of exposed zoom methods reduced
Nov 9, 2013
1814152
added change listener for zoom
Nov 9, 2013
757de1f
some refactoring
Nov 9, 2013
d2c1e87
changed test for coordinates
Nov 9, 2013
4c522ac
Merge branch 'zoom' into exp
Nov 9, 2013
7d6828d
replaced update zoom
Nov 9, 2013
4c198cb
zoom coordinate calculation based on previous zoom
Nov 10, 2013
3d8b8e9
moved all jemmy test into a new package & added logging for path to l…
Nov 13, 2013
75ace12
changed path to build
Nov 13, 2013
79721a4
ignore map tests at the moment
Nov 13, 2013
b955c8d
Merge pull request #72 from Mario-S/2.2
mario-s Nov 13, 2013
d13d6dc
property for build path uses project.buildDir
Nov 13, 2013
5f8543d
changed assert to assume for locale image
Nov 13, 2013
89d5da5
removed assert for image to avoid calling of toolkit
Nov 13, 2013
c125ad8
changed assert to assume for zoom level
Nov 13, 2013
b45cd1c
Merge pull request #75 from Mario-S/2.2
mario-s Nov 13, 2013
0654e28
exchanged 'if' with 'assumeTrue'
Nov 13, 2013
d58e6f9
Merge pull request #76 from Mario-S/2.2
mario-s Nov 13, 2013
d0b58c6
Added optional timed dialog functionality where dialog will fade in, …
mkheck Nov 17, 2013
d958b91
cosmetics, small fixes
Nov 17, 2013
9479ce8
Fixed issue with short-duration timed dialog display (hat tip to Jose…
mkheck Nov 17, 2013
afc860d
zoom based on property change
Nov 23, 2013
45136cc
Merge branch 'exp' into 2.2
Nov 23, 2013
489539c
changed more to assume in case of mouse is not supported
Nov 23, 2013
f154c89
Merge pull request #78 from Mario-S/2.2
mario-s Nov 23, 2013
a57e430
forcing to center the map removed, javadoc added, cleanup
mario-s Dec 2, 2013
2dd98b0
fix a calendar equality bug
tbee Dec 6, 2013
974596b
Update BeanPathAdapter.java
Jugen Dec 18, 2013
c40e74f
Update BeanPathAdapter.java
Jugen Dec 18, 2013
40209a9
Update BeanPathAdapter.java
Jugen Dec 20, 2013
9c55e74
Update BeanPathAdapter.java
Jugen Dec 20, 2013
708deed
property name change
tbee Dec 21, 2013
00c7315
Update OdometerSkin.java
vvUnai Dec 22, 2013
51ea6a5
Update Odometer.java
vvUnai Dec 22, 2013
128f75e
Styling for today is always removed first and then re-added if the da…
gurkok Dec 24, 2013
6362a93
Merge pull request #86 from gurkok/2.2
tbee Dec 24, 2013
0f9bbce
CSS fixes
tbee Dec 24, 2013
8a7f57d
cleanup & TODO fixed
mario-s Jan 2, 2014
a6b2eb7
added readme for test folder
mario-s Jan 2, 2014
f603ff6
Merge pull request #87 from Mario-S/2.2
mario-s Jan 2, 2014
bcc8206
mouse handling simplified
mario-s Jan 7, 2014
c131346
Merge pull request #88 from Mario-S/2.2
mario-s Jan 7, 2014
ddd4efe
build script warning fixed
mario-s Jan 8, 2014
e65d971
Merge pull request #89 from Mario-S/2.2
mario-s Jan 8, 2014
5490e0c
Header update.
mkheck Jan 26, 2014
742d06c
Merge branch '2.2' of https://github.com/JFXtras/jfxtras-labs into 2.2
mkheck Jan 26, 2014
0363553
fixed a bug
tbee Feb 6, 2014
f9054c6
Merge branch '2.2' of https://github.com/JFXtras/jfxtras-labs into 2.2
tbee Feb 6, 2014
a45a01f
zoom to point based on property change
mario-s Feb 8, 2014
904e860
removed zoom to point
mario-s Feb 8, 2014
75dcaed
temp workaround for zoom to point
mario-s Feb 8, 2014
7204e60
coordinate shifting with zoom to point fixed
mario-s Feb 9, 2014
37e9c21
storing of zoom start simplified
mario-s Feb 9, 2014
86bcca9
unit test for map added
mario-s Feb 9, 2014
ec36dc9
added javadoc
mario-s Feb 9, 2014
d596580
some javadoc fixed
mario-s Feb 9, 2014
9860c9b
Merge pull request #90 from Mario-S/2.2
mario-s Feb 9, 2014
2d00778
fixed another problem with zoom to point & added more documentation
mario-s Feb 12, 2014
24653ad
Merge pull request #91 from Mario-S/2.2
mario-s Feb 12, 2014
0d526bd
NetBeans Gradle properties file removed
mario-s Feb 12, 2014
5ce3141
Merge pull request #92 from Mario-S/2.2
mario-s Feb 12, 2014
7fc0bea
changed tests for CI
mario-s Feb 12, 2014
f578e99
Merge pull request #93 from Mario-S/2.2
mario-s Feb 12, 2014
d235078
Merge pull request #85 from vvUnai/2.2
Mar 3, 2014
9ef05ac
Merge pull request #82 from Jugen/BeanPathAdapter-beanProperty
ugate Jan 2, 2015
caefd82
Merge pull request #1 from JFXtras/2.2
jdetomasi Jan 6, 2015
671a169
Update BeanPathAdapter.java
jdetomasi Jan 6, 2015
3887189
Update BeanPathAdapter.java
jdetomasi Jan 6, 2015
c496c6c
Update LedBargraphSkin.java
deamn Jan 7, 2015
122391f
Merge pull request #105 from deamn/patch-1
tbee Jan 7, 2015
baad523
Merge pull request #102 from juliandt/2.2
ugate Jan 7, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refresh feature in progress
  • Loading branch information
Mario authored and Mario committed Aug 27, 2013
commit 74c5e6a9732d8bc2f69baeb90f51d75f390ce7ec
5 changes: 2 additions & 3 deletions src/main/java/jfxtras/labs/map/MapPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import javafx.scene.text.FontSmoothingType;
import javafx.scene.text.Text;
import jfxtras.labs.map.render.TileRenderer;
import jfxtras.labs.map.tile.TilesProvideable;
import jfxtras.labs.map.tile.TileProvideable;
import jfxtras.labs.map.tile.TileRepository;
import static javafx.collections.FXCollections.*;
import static jfxtras.labs.map.CoordinatesConverter.*;
Expand All @@ -69,7 +69,7 @@ public final class MapPane extends Pane implements MapTilesourceable {

private static final String STYLE_LOC = "cursorLocation";

private TilesProvideable tilesProvider;
private TileProvideable tilesProvider;

private TileRenderable tileRenderer;

Expand Down Expand Up @@ -379,7 +379,6 @@ public void moveMap(int x, int y) {
center.x += x;
center.y += y;

//TODO check on edge
if(prepareTiles() > 0 && !isOnEdge()){
tilesPrepared = true;
}else{
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/jfxtras/labs/map/MapTilesourceable.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package jfxtras.labs.map;

import javafx.scene.Group;
import jfxtras.labs.map.tile.TileSource;

/**
Expand All @@ -10,8 +9,6 @@
*/
public interface MapTilesourceable extends CursorLocationable{

Group getTilesGroup();

TileSource getTileSource();

}
4 changes: 4 additions & 0 deletions src/main/java/jfxtras/labs/map/Moveable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.awt.Point;

import javafx.scene.Group;

/**
* This interface defines methods to move the map.
*
Expand Down Expand Up @@ -43,4 +45,6 @@ public interface Moveable extends Zoomable{
*/
void centerMap();

Group getTilesGroup();

}
2 changes: 1 addition & 1 deletion src/main/java/jfxtras/labs/map/TilesMouseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private class MouseReleasedAdapter implements EventHandler<MouseEvent> {
@Override
public void handle(MouseEvent me) {
tilesGroup.setCursor(Cursor.CROSSHAIR);
if (isMoveable()) {
if(isMoveable()){
moveMap(me);
dragStartPoint = null;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/jfxtras/labs/map/render/TileRenderable.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public interface TileRenderable {
*/
void render(Group tilesGroup);

/**
* Reloads all tile which currently visible.
* @param mapController
*/
void refresh(Moveable mapController);

/**
* Turn monochrome mode on/off.
* @param val
Expand Down
45 changes: 24 additions & 21 deletions src/main/java/jfxtras/labs/map/render/TileRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import jfxtras.labs.map.Moveable;
import jfxtras.labs.map.tile.DefaultTilesLoader;
import jfxtras.labs.map.tile.TilesProvideable;
import jfxtras.labs.map.tile.CacheLoadStrategy;
import jfxtras.labs.map.tile.RefreshLoadStrategy;
import jfxtras.labs.map.tile.TileProvideable;
import jfxtras.labs.map.tile.TileImageComparator;
import jfxtras.labs.map.tile.TileImage;
import jfxtras.labs.map.tile.TilesLoadable;
import jfxtras.labs.map.tile.TileSource;
import jfxtras.labs.map.tile.TilesLoader;

/**
* Rendered for map tiles.
Expand All @@ -41,21 +43,32 @@ public class TileRenderer implements TileRenderable {

private List<TileImage> tileImages;

private final TilesProvideable tileCache;
private final TileProvideable provider;


public TileRenderer(TilesProvideable tileCache) {
this.tileCache = tileCache;
public TileRenderer(TileProvideable provider) {
this.provider = provider;
this.tileImages = emptyList();
}

@Override
public int prepareTiles(Moveable mapController) {

tileImages = loadTiles(mapController);
provider.setStrategy(new CacheLoadStrategy());
TilesLoadable tileLoader = new TilesLoader(provider);
tileImages = tileLoader.loadTiles(mapController);
return tileImages.size();
}


@Override
public void refresh(Moveable mapController) {
provider.setStrategy(new RefreshLoadStrategy());
TilesLoadable tileLoader = new TilesLoader(provider);
tileImages = tileLoader.loadTiles(mapController);
if(tileImages.isEmpty()){
render(mapController.getTilesGroup());
}
}

@Override
public Point[] getBounds() {
Point[] bounds = new Point[0];
Expand All @@ -72,21 +85,11 @@ public Point[] getBounds() {
return bounds;
}

/**
* Load the tiles in a spiral, starting from center of the map.
*/
private List<TileImage> loadTiles(Moveable mapController) {

TilesLoadable tileLoader = new DefaultTilesLoader(tileCache);
return tileLoader.loadTiles(mapController);
}

private int getTileSize() {
TileSource tileSource = tileCache.getTileSource();
TileSource tileSource = provider.getTileSource();
return tileSource.getTileSize();
}


@Override
public void render(Group tilesGroup) {

Expand All @@ -109,7 +112,7 @@ public void render(Group tilesGroup) {
}

if (tileGridVisible) {
tilesGroup.getChildren().add(createGrid(posx, posy, tilesize));
tilesGroup.getChildren().add(createBorder(posx, posy, tilesize));
}
}
}
Expand All @@ -123,7 +126,7 @@ private void setMonochromeEffect(ImageView imageView) {
imageView.setEffect(monochrome);
}

protected Path createGrid(int posx, int posy, int tilesize) {
protected Path createBorder(int posx, int posy, int tilesize) {

Path path = new Path();
path.getElements().add(new MoveTo(posx, posy));
Expand Down
75 changes: 75 additions & 0 deletions src/main/java/jfxtras/labs/map/tile/AbstractTileLoadStrategy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package jfxtras.labs.map.tile;

import java.util.Objects;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.image.Image;

/**
* Abstract parent class for tile load commands.
* @author Mario Schroeder
*
*/
public abstract class AbstractTileLoadStrategy implements TileLoadStrategy{
protected TileInfoCache cache;

public void setCache(TileInfoCache cache){
this.cache = cache;
}

Tile createTile(String location) {
Tile tile = new Tile(location);
loadImage(tile);
return tile;
}

private void loadImage(Tile tile) {
ChangeListener<Boolean> listener = new ImageLoadedListener(tile);
tile.imageLoadedProperty().addListener(listener);
tile.loadImage();
}

@Override
public String toString() {
return getClass().getSimpleName();
}

@Override
public boolean equals(Object obj) {
boolean equal = false;
if(obj != null && getClass() == obj.getClass()){
equal = Objects.equals(this.toString(), obj.toString());
}
return equal;
}

@Override
public int hashCode() {
return toString().hashCode();
}

private class ImageLoadedListener implements ChangeListener<Boolean> {

private Tile tile;

public ImageLoadedListener(Tile tile) {
this.tile = tile;
}

@Override
public void changed(
ObservableValue<? extends Boolean> ov, Boolean oldVal, Boolean newVal) {
if (newVal.booleanValue()) {
addImage(tile.getLocation(), tile.getImageView().getImage());
}
}

private void addImage(String tileLocation, Image image) {

long timeStamp = System.currentTimeMillis();
TileInfo info = new TileInfo(timeStamp, image);
cache.put(tileLocation, info);
}
}
}
25 changes: 25 additions & 0 deletions src/main/java/jfxtras/labs/map/tile/CacheLoadStrategy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package jfxtras.labs.map.tile;

/**
* This class checks the {@link TileInfoCache} first if the
* {@link Tile} exists and loads it from there.
*
* @author Mario Schroeder
*
*/
public class CacheLoadStrategy extends AbstractTileLoadStrategy {

@Override
public Tile execute(String location) {
Tile tile;
TileInfo info = cache.get(location);

if (info != null) {
tile = new Tile(location, info.getImage());
} else {
tile = createTile(location);
}
return tile;
}

}
22 changes: 22 additions & 0 deletions src/main/java/jfxtras/labs/map/tile/RefreshLoadStrategy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package jfxtras.labs.map.tile;

/**
* This class reloads the {@link Tile} in the {@link TileInfoCache}.
*
* @author Mario Schroeder
*
*/
public class RefreshLoadStrategy extends AbstractTileLoadStrategy {

@Override
public Tile execute(String location) {
TileInfo info = cache.get(location);

if (info != null) {
cache.remove(location);
}

return createTile(location);
}

}
13 changes: 13 additions & 0 deletions src/main/java/jfxtras/labs/map/tile/TileLoadStrategy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package jfxtras.labs.map.tile;

/**
* Interface for way to load the tiles.
* @author Mario Schroeder
*
*/
public interface TileLoadStrategy {

Tile execute(String location);

void setCache(TileInfoCache cache);
}
24 changes: 24 additions & 0 deletions src/main/java/jfxtras/labs/map/tile/TileProvideable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package jfxtras.labs.map.tile;

/**
* This interface defines methods to load the tile.
* The loading algorithm can be influenced with the {@link TileLoadStrategy}.
* @author Mario Schroeder
*
*/
public interface TileProvideable extends TilesSourceAccessable{

/**
* Returns the tile for x, y and zoom.
* It might also return null if the arguments are invalid.
* @param tilex x position of the tile
* @param tiley y position of the tile
* @param zoom the zoom level
* @return the {@link Tile} or null if arguments are invalid.
*/
Tile getTile(int tilex, int tiley, int zoom);

void setStrategy(TileLoadStrategy strategy);

TileLoadStrategy getStrategy();
}
Loading