added image url checking, removed redundant url type
This commit is contained in:
parent
6904663e59
commit
73b74bcee3
@ -68,7 +68,7 @@ public class TopAlbumController {
|
|||||||
dropDownLimit.getItems().add(i);
|
dropDownLimit.getItems().add(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 20; i < 110; i+=10) {
|
for (int i = 20; i < 110; i += 10) {
|
||||||
dropDownLimit.getItems().add(i);
|
dropDownLimit.getItems().add(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,23 +169,26 @@ public class TopAlbumController {
|
|||||||
|
|
||||||
Album album = (Album) obj;
|
Album album = (Album) obj;
|
||||||
|
|
||||||
GetFXImageService service = new GetFXImageService(album.getImageURL().toString(), counter);
|
if (album.getImageURL() != null) {
|
||||||
|
|
||||||
service.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
|
GetFXImageService service = new GetFXImageService(album.getImageURL(), counter);
|
||||||
|
|
||||||
@Override
|
service.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
|
||||||
public void handle(WorkerStateEvent t) {
|
|
||||||
|
|
||||||
TiledImage image = (TiledImage) t.getSource().getValue();
|
@Override
|
||||||
|
public void handle(WorkerStateEvent t) {
|
||||||
|
|
||||||
images.add(image);
|
TiledImage image = (TiledImage) t.getSource().getValue();
|
||||||
|
|
||||||
refreshImages();
|
images.add(image);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
service.start();
|
refreshImages();
|
||||||
counter++;
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
service.start();
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,7 +209,7 @@ public class TopAlbumController {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
for(TiledImage image: images) {
|
for (TiledImage image : images) {
|
||||||
list.add(new ImageView(image));
|
list.add(new ImageView(image));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,14 @@ import javax.imageio.ImageIO;
|
|||||||
|
|
||||||
import sarsoo.fmframework.cache.Cacheable;
|
import sarsoo.fmframework.cache.Cacheable;
|
||||||
|
|
||||||
public class Album extends FMObj implements Serializable, Cacheable{
|
public class Album extends FMObj implements Serializable, Cacheable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
protected Artist artist;
|
protected Artist artist;
|
||||||
protected ArrayList<Tag> tagList;
|
protected ArrayList<Tag> tagList;
|
||||||
protected ArrayList<Track> trackList;
|
protected ArrayList<Track> trackList;
|
||||||
|
|
||||||
protected URL imageUrl;
|
protected String imageUrl;
|
||||||
protected BufferedImage image;
|
protected BufferedImage image;
|
||||||
|
|
||||||
private Album(AlbumBuilder builder) {
|
private Album(AlbumBuilder builder) {
|
||||||
@ -42,13 +42,13 @@ public class Album extends FMObj implements Serializable, Cacheable{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public URL getImageURL() {
|
public String getImageURL() {
|
||||||
return imageUrl;
|
return imageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadImage() {
|
public void loadImage() {
|
||||||
try {
|
try {
|
||||||
image = ImageIO.read(imageUrl);
|
image = ImageIO.read(new URL(imageUrl));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ public class Album extends FMObj implements Serializable, Cacheable{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AlbumBuilder{
|
public static class AlbumBuilder {
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
protected Artist artist;
|
protected Artist artist;
|
||||||
@ -113,8 +113,7 @@ public class Album extends FMObj implements Serializable, Cacheable{
|
|||||||
protected ArrayList<Tag> tagList;
|
protected ArrayList<Tag> tagList;
|
||||||
protected ArrayList<Track> trackList;
|
protected ArrayList<Track> trackList;
|
||||||
|
|
||||||
protected URL imageUrl;
|
protected String imageUrl;
|
||||||
|
|
||||||
|
|
||||||
public AlbumBuilder(String name, Artist artist) {
|
public AlbumBuilder(String name, Artist artist) {
|
||||||
|
|
||||||
@ -163,11 +162,7 @@ public class Album extends FMObj implements Serializable, Cacheable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AlbumBuilder setImageUrl(String url) {
|
public AlbumBuilder setImageUrl(String url) {
|
||||||
try {
|
this.imageUrl = url;
|
||||||
this.imageUrl = new URL(url);
|
|
||||||
} catch (MalformedURLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,10 +173,10 @@ public class Album extends FMObj implements Serializable, Cacheable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<Scrobble> getScrobbles() {
|
public ArrayList<Scrobble> getScrobbles() {
|
||||||
if(trackList != null) {
|
if (trackList != null) {
|
||||||
if (trackList.size() > 0) {
|
if (trackList.size() > 0) {
|
||||||
ArrayList<Scrobble> scrobbles = new ArrayList<Scrobble>();
|
ArrayList<Scrobble> scrobbles = new ArrayList<Scrobble>();
|
||||||
for (Track i: trackList) {
|
for (Track i : trackList) {
|
||||||
scrobbles.addAll(i.getScrobbles());
|
scrobbles.addAll(i.getScrobbles());
|
||||||
}
|
}
|
||||||
return scrobbles;
|
return scrobbles;
|
||||||
|
Loading…
Reference in New Issue
Block a user