@@ -0,0 +1,188 @@
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Agenda implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
private ArrayList<Stage> stages;
|
||||
private ArrayList<Event> events;
|
||||
private ArrayList<Artist> artists;
|
||||
|
||||
public Agenda() {
|
||||
stages = new ArrayList<Stage>();
|
||||
events = new ArrayList<Event>();
|
||||
artists = new ArrayList<Artist>();
|
||||
}
|
||||
|
||||
public void addStage(Stage stage) {
|
||||
stages.add(stage);
|
||||
}
|
||||
|
||||
public void addEvent(Event event) {
|
||||
events.add(event);
|
||||
}
|
||||
|
||||
public void addArtist(Artist artist) {
|
||||
artists.add(artist);
|
||||
}
|
||||
|
||||
public void fillArtists() {
|
||||
FileInputStream fis = null;
|
||||
ObjectInputStream ois = null;
|
||||
|
||||
try {
|
||||
fis = new FileInputStream("artists.dat");
|
||||
ois = new ObjectInputStream(fis);
|
||||
|
||||
Object object;
|
||||
object = ois.readObject();
|
||||
try {
|
||||
while (object != null) {
|
||||
artists.add((Artist) object);
|
||||
object = ois.readObject();
|
||||
}
|
||||
} catch (EOFException e) {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void fillEvents() {
|
||||
FileInputStream fis = null;
|
||||
ObjectInputStream ois = null;
|
||||
|
||||
try {
|
||||
fis = new FileInputStream("events.dat");
|
||||
ois = new ObjectInputStream(fis);
|
||||
|
||||
Object object;
|
||||
object = ois.readObject();
|
||||
try {
|
||||
while (object != null) {
|
||||
events.add((Event) object);
|
||||
object = ois.readObject();
|
||||
}
|
||||
} catch (EOFException e) {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void fillStages() {
|
||||
FileInputStream fis = null;
|
||||
ObjectInputStream ois = null;
|
||||
|
||||
try {
|
||||
fis = new FileInputStream("stages.dat");
|
||||
ois = new ObjectInputStream(fis);
|
||||
|
||||
Object object;
|
||||
object = ois.readObject();
|
||||
try {
|
||||
while (object != null) {
|
||||
stages.add((Stage) object);
|
||||
object = ois.readObject();
|
||||
}
|
||||
} catch (EOFException e) {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveStages() {
|
||||
|
||||
try {
|
||||
File file = new File("stages.dat");
|
||||
if (!file.exists()){
|
||||
file.createNewFile();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
||||
for (Stage stage : stages) {
|
||||
oos.writeObject(stage);
|
||||
}
|
||||
oos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveEvents() {
|
||||
|
||||
try {
|
||||
File file = new File("events.dat");
|
||||
if (!file.exists()){
|
||||
file.createNewFile();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
||||
for (Event event : events) {
|
||||
oos.writeObject(event);
|
||||
}
|
||||
oos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveArtists() {
|
||||
|
||||
try {
|
||||
File file = new File("artists.dat");
|
||||
if (!file.exists()){
|
||||
file.createNewFile();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
||||
for (Artist artist : artists) {
|
||||
oos.writeObject(artist);
|
||||
}
|
||||
oos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void addEvents()
|
||||
{
|
||||
int ID = 0;
|
||||
for (Stage stage : stages)
|
||||
{
|
||||
ID = stage.getID();
|
||||
for (Event event : events)
|
||||
{
|
||||
if ( ID == event.getID())
|
||||
{
|
||||
stage.addEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveAll()
|
||||
{
|
||||
saveArtists();
|
||||
saveEvents();
|
||||
saveStages();
|
||||
}
|
||||
|
||||
public void fillAll()
|
||||
{
|
||||
fillArtists();
|
||||
fillEvents();
|
||||
fillStages();
|
||||
addEvents();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
|
||||
public class Artist implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
private String name;
|
||||
private String genre;
|
||||
private ImageIcon image;
|
||||
private String description;
|
||||
|
||||
public Artist(String name, String genre, String image, String description)
|
||||
{
|
||||
this.name = name;
|
||||
this.genre = genre;
|
||||
this.description = description;
|
||||
|
||||
if ( !image.equals("null")) {
|
||||
this.image = new ImageIcon(image);
|
||||
} else {
|
||||
this.image = null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getGenre()
|
||||
{
|
||||
return this.genre;
|
||||
}
|
||||
|
||||
public ImageIcon getImage()
|
||||
{
|
||||
return this.image;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setGenre(String genre)
|
||||
{
|
||||
this.genre = genre;
|
||||
}
|
||||
|
||||
public void setImageIconString(String image)
|
||||
{
|
||||
this.image = new ImageIcon(image);
|
||||
}
|
||||
|
||||
public void setImageIcon(ImageIcon image)
|
||||
{
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
|
||||
public class Artist
|
||||
{
|
||||
private String genre;
|
||||
private String name;
|
||||
private String description;
|
||||
private ImageIcon image;
|
||||
private int id;
|
||||
|
||||
public Artist()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class Data
|
||||
{
|
||||
private ArrayList<Stage> stages;
|
||||
private ArrayList<Event> events;
|
||||
private ArrayList<Artist> artists;
|
||||
|
||||
public Data()
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
import java.io.Serializable;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
public class Event implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
private GregorianCalendar startDate;
|
||||
private GregorianCalendar endDate;
|
||||
private Artist artist;
|
||||
private String description;
|
||||
private int expectedPopularity;
|
||||
private int ID;
|
||||
|
||||
public Event(int startYear, int startMonth, int startDay, int startHour,
|
||||
int startMinute, int endYear, int endMonth, int endDay,
|
||||
int endHour, int endMinute, Artist artist, String description,
|
||||
int expectedPopularity, int ID) {
|
||||
startDate = new GregorianCalendar(startYear, startMonth - 1, startDay,
|
||||
startHour, startMinute);
|
||||
endDate = new GregorianCalendar(endYear, endMonth - 1, endDay, endHour,
|
||||
endMinute);
|
||||
this.artist = artist;
|
||||
this.description = description;
|
||||
this.expectedPopularity = expectedPopularity;
|
||||
this.ID = ID;
|
||||
}
|
||||
|
||||
public GregorianCalendar getStartDate() {
|
||||
return this.startDate;
|
||||
}
|
||||
|
||||
public GregorianCalendar getEndDate() {
|
||||
return this.endDate;
|
||||
}
|
||||
|
||||
public Artist getArtist() {
|
||||
return this.artist;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return this.ID;
|
||||
}
|
||||
|
||||
public int getExpectedPopularity() {
|
||||
return this.expectedPopularity;
|
||||
}
|
||||
|
||||
public void setStartDate(int startYear, int startMonth, int startDay,
|
||||
int startHour, int startMinute) {
|
||||
startDate.set(startYear, startMonth - 1, startDay, startHour,
|
||||
startMinute);
|
||||
}
|
||||
|
||||
public void setEndDate(int endYear, int endMonth, int endDay, int endHour,
|
||||
int endMinute) {
|
||||
endDate.set(endYear, endMonth - 1, endDay, endHour, endMinute);
|
||||
}
|
||||
|
||||
public void setArtist(Artist artist) {
|
||||
this.artist.setName(artist.getName());
|
||||
this.artist.setGenre(artist.getGenre());
|
||||
this.artist.setImageIcon(artist.getImage());
|
||||
this.artist.setDescription(artist.getDescription());
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setExpectedPopularity(int popularity) {
|
||||
this.expectedPopularity = popularity;
|
||||
}
|
||||
|
||||
public void setID(int ID) {
|
||||
this.ID = ID;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
DateFormat format = new SimpleDateFormat("dd-MM-yyyy");
|
||||
format.setLenient(false);
|
||||
|
||||
return artist.getName() + " plays from "
|
||||
+ format.format(startDate.getTime()) + " to "
|
||||
+ format.format(endDate.getTime()) + ".";
|
||||
}
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
|
||||
public class Event
|
||||
{
|
||||
private int startTime;
|
||||
private int endTime;
|
||||
private Artist artist;
|
||||
private String description;
|
||||
private int id;
|
||||
|
||||
public Event()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
public class Panel extends JPanel
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
# FestivalPlanner
|
||||
Avans - Technische Informatica - Periode 3 - Project Festival Planner
|
||||
|
||||
##Project Leden
|
||||
* Kenneth van Ewijk
|
||||
* Remco Sannen
|
||||
* Wesley de Hek
|
||||
* Yorick Rommers
|
||||
* Guus van Dongen
|
||||
|
||||
##Taakverdeling
|
||||
| Deel | Wie |
|
||||
| ---------- |-----------|
|
||||
|Achterliggende code|Guus van Dongen|
|
||||
|Tijdlijn|Yorick Rommers|
|
||||
|Window|Kenneth van Ewijk|
|
||||
|Tabel overzicht|Wesley de Hek|
|
||||
|Event Details|Remco Sannen|
|
||||
|Artiest|-|
|
||||
@@ -0,0 +1,49 @@
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class Stage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
private ArrayList<Event> events;
|
||||
private String description;
|
||||
private int ID;
|
||||
|
||||
public Stage(String description, int ID )
|
||||
{
|
||||
this.events = new ArrayList<Event>();
|
||||
this.description = description;
|
||||
this.ID = ID;
|
||||
}
|
||||
|
||||
public Event getEvent(int number)
|
||||
{
|
||||
return events.get(number);
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return this.ID;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setID(int ID)
|
||||
{
|
||||
this.ID = ID;
|
||||
}
|
||||
|
||||
public void addEvent(Event event)
|
||||
{
|
||||
events.add(event);
|
||||
}
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class Stage
|
||||
{
|
||||
private ArrayList<Event> performances;
|
||||
private int expectedPopularity;
|
||||
private String description;
|
||||
|
||||
public Stage()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
Eventuele methode om de Arraylisten mee te vullen.
|
||||
|
||||
public void test()
|
||||
{
|
||||
Artist artist = new Artist("Paul", "Rock", "null", "description");
|
||||
Event e = new Event(2015,2,13,15,0,2015,2,13,16,0,artist,"Description",7, 1);
|
||||
Stage s = new Stage("Main Stage", 1);
|
||||
|
||||
addArtist(artist);
|
||||
addEvent(e);
|
||||
addStage(s);
|
||||
|
||||
saveAll();
|
||||
fillAll();
|
||||
System.out.println("Saved All Data!");
|
||||
}
|
||||
Reference in New Issue
Block a user