Merge remote-tracking branch 'origin/kenneth' into develop
This commit is contained in:
+17
-1
@@ -51,7 +51,20 @@ public class Agenda implements Serializable {
|
|||||||
{
|
{
|
||||||
return stages;
|
return stages;
|
||||||
}
|
}
|
||||||
|
public ArrayList<Event> eventsForStage(AgendaStage st)
|
||||||
|
{
|
||||||
|
ArrayList<Event> stageEvents = new ArrayList<Event>();
|
||||||
|
for(Event e: events)
|
||||||
|
{
|
||||||
|
if(e.getStage() == st)
|
||||||
|
{
|
||||||
|
stageEvents.add(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stageEvents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public void saveAgenda()
|
public void saveAgenda()
|
||||||
{
|
{
|
||||||
JFileChooser fileChooser = new JFileChooser();
|
JFileChooser fileChooser = new JFileChooser();
|
||||||
@@ -179,7 +192,7 @@ public class Agenda implements Serializable {
|
|||||||
{
|
{
|
||||||
boolean exists = false;
|
boolean exists = false;
|
||||||
String name = e.getStage().getName();
|
String name = e.getStage().getName();
|
||||||
for (AgendaStage s : stages)
|
for (Stage s : stages)
|
||||||
{
|
{
|
||||||
if ( s.getName().equals(name) ) {
|
if ( s.getName().equals(name) ) {
|
||||||
exists = true;
|
exists = true;
|
||||||
@@ -203,6 +216,7 @@ public class Agenda implements Serializable {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public void clearAgenda()
|
public void clearAgenda()
|
||||||
{
|
{
|
||||||
@@ -211,10 +225,12 @@ public class Agenda implements Serializable {
|
|||||||
artists.clear();
|
artists.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public void fillAllLists()
|
public void fillAllLists()
|
||||||
{
|
{
|
||||||
loadAgenda();
|
loadAgenda();
|
||||||
fillStages();
|
fillStages();
|
||||||
fillArtists();
|
fillArtists();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
+3
-2
@@ -63,7 +63,8 @@ public class MenuBar extends JMenuBar {
|
|||||||
open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
|
open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
|
||||||
open.addActionListener(new ActionListener() {
|
open.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
w.getAgenda().loadAgenda();
|
Applicatie.SaveLoad.load(w.getPanel());
|
||||||
|
w.setAgenda(w.getPanel().getAgenda());
|
||||||
Window.updatePanel();
|
Window.updatePanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -72,7 +73,7 @@ public class MenuBar extends JMenuBar {
|
|||||||
save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
|
save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
|
||||||
save.addActionListener(new ActionListener() {
|
save.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
w.getAgenda().saveAgenda();
|
Applicatie.SaveLoad.save(w.getPanel());
|
||||||
Window.updatePanel();
|
Window.updatePanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+10
-3
@@ -1,6 +1,5 @@
|
|||||||
package Agenda;
|
package Agenda;
|
||||||
|
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@@ -36,14 +35,16 @@ public class Window extends JFrame {
|
|||||||
private static GregorianCalendar date;
|
private static GregorianCalendar date;
|
||||||
private static Agenda agenda;
|
private static Agenda agenda;
|
||||||
private static String currentPanel = "table";
|
private static String currentPanel = "table";
|
||||||
|
private Applicatie.Panel ap;
|
||||||
|
|
||||||
public Window()
|
public Window(Applicatie.Panel ap)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Initialize window
|
* Initialize window
|
||||||
*/
|
*/
|
||||||
super("Agenda");
|
super("Agenda");
|
||||||
agenda = new Agenda();
|
this.ap = ap;
|
||||||
|
agenda = ap.getAgenda();
|
||||||
|
|
||||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||||
addWindowListener(new WindowAdapter() {
|
addWindowListener(new WindowAdapter() {
|
||||||
@@ -231,6 +232,12 @@ public class Window extends JFrame {
|
|||||||
public void setAgenda(Agenda a)
|
public void setAgenda(Agenda a)
|
||||||
{
|
{
|
||||||
agenda = a;
|
agenda = a;
|
||||||
|
ap.setAgenda(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Applicatie.Panel getPanel()
|
||||||
|
{
|
||||||
|
return ap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-12
@@ -33,11 +33,13 @@ public class MenuBar extends JMenuBar
|
|||||||
{
|
{
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
new Agenda.Window();
|
new Agenda.Window(w.getPanel());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
file.add(agenda);
|
file.add(agenda);
|
||||||
|
|
||||||
|
file.addSeparator();
|
||||||
|
|
||||||
item = new JMenuItem("Open");
|
item = new JMenuItem("Open");
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@@ -60,22 +62,12 @@ public class MenuBar extends JMenuBar
|
|||||||
|
|
||||||
file.addSeparator();
|
file.addSeparator();
|
||||||
|
|
||||||
item = new JMenuItem("Load agenda");
|
|
||||||
item.addActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
w.getPanel().agenda.loadAgenda();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
file.add(item);
|
|
||||||
|
|
||||||
item = new JMenuItem("Agenda");
|
item = new JMenuItem("Agenda");
|
||||||
item.addActionListener(new ActionListener()
|
item.addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
new Agenda.Window();
|
new Agenda.Window(w.getPanel());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
file.add(item);
|
file.add(item);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import javax.swing.JFileChooser;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
|
import Agenda.Agenda;
|
||||||
import Objects.DrawObject;
|
import Objects.DrawObject;
|
||||||
|
|
||||||
public class SaveLoad {
|
public class SaveLoad {
|
||||||
@@ -66,6 +67,7 @@ public class SaveLoad {
|
|||||||
try {
|
try {
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
ObjectOutputStream oos = new ObjectOutputStream(fos);
|
||||||
|
oos.writeObject(panel.getAgenda());
|
||||||
for (DrawObject object : panel.objects) {
|
for (DrawObject object : panel.objects) {
|
||||||
oos.writeObject(object);
|
oos.writeObject(object);
|
||||||
}
|
}
|
||||||
@@ -124,8 +126,10 @@ public class SaveLoad {
|
|||||||
ois = new ObjectInputStream(fis);
|
ois = new ObjectInputStream(fis);
|
||||||
|
|
||||||
Object object;
|
Object object;
|
||||||
object = ois.readObject();
|
Agenda a = (Agenda) ois.readObject();
|
||||||
|
panel.setAgenda(a);
|
||||||
try {
|
try {
|
||||||
|
object = ois.readObject();
|
||||||
panel.clearObjects();
|
panel.clearObjects();
|
||||||
while (object != null) {
|
while (object != null) {
|
||||||
panel.objects.add((DrawObject) object);
|
panel.objects.add((DrawObject) object);
|
||||||
|
|||||||
+19
-1
@@ -15,6 +15,7 @@ import java.io.Serializable;
|
|||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
import Applicatie.Images;
|
import Applicatie.Images;
|
||||||
|
import Applicatie.Panel;
|
||||||
|
|
||||||
public abstract class DrawObject implements Serializable
|
public abstract class DrawObject implements Serializable
|
||||||
{
|
{
|
||||||
@@ -232,13 +233,30 @@ public abstract class DrawObject implements Serializable
|
|||||||
|
|
||||||
public void setPosition(Point2D position)
|
public void setPosition(Point2D position)
|
||||||
{
|
{
|
||||||
|
if(position.getX() < -Panel.getFieldWidth()/2)
|
||||||
|
{
|
||||||
|
position.setLocation(-Panel.getFieldWidth()/2, position.getY());
|
||||||
|
}
|
||||||
|
if(position.getY() < -Panel.getFieldHeight()/2)
|
||||||
|
{
|
||||||
|
position.setLocation(position.getX(), -Panel.getFieldHeight()/2);
|
||||||
|
}
|
||||||
|
if(position.getX() > Panel.getFieldWidth()/2 - width)
|
||||||
|
{
|
||||||
|
position.setLocation(Panel.getFieldWidth()/2-width, position.getY());
|
||||||
|
}
|
||||||
|
if(position.getY() > Panel.getFieldHeight()/2 - height)
|
||||||
|
{
|
||||||
|
position.setLocation(position.getX(), Panel.getFieldHeight()/2-height);
|
||||||
|
}
|
||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
public void setPosition(Point2D position, boolean b)
|
public void setPosition(Point2D position, boolean b)
|
||||||
{
|
{
|
||||||
this.position = position;
|
setPosition(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public double getRotation()
|
public double getRotation()
|
||||||
{
|
{
|
||||||
return rotation;
|
return rotation;
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 8.0 KiB |
Reference in New Issue
Block a user