Merge guus dev
This commit is contained in:
@@ -205,9 +205,9 @@ public class AddEventPanel extends JFrame{
|
|||||||
|
|
||||||
String stageName = (String)stage2.getSelectedItem();
|
String stageName = (String)stage2.getSelectedItem();
|
||||||
|
|
||||||
Stage stage = null;
|
AgendaStage stage = null;
|
||||||
|
|
||||||
for(Stage s : agenda.getStages())
|
for(AgendaStage s : agenda.getStages())
|
||||||
{
|
{
|
||||||
if (s.getName().equals(stageName))
|
if (s.getName().equals(stageName))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class AddStagePanel extends JFrame{
|
|||||||
String description = descriptionTF.getText();
|
String description = descriptionTF.getText();
|
||||||
|
|
||||||
boolean alreadyExists = false;
|
boolean alreadyExists = false;
|
||||||
for (Stage stage : agenda.getStages())
|
for (AgendaStage stage : agenda.getStages())
|
||||||
{
|
{
|
||||||
if (stage.getName().equals(name))
|
if (stage.getName().equals(name))
|
||||||
{
|
{
|
||||||
@@ -70,7 +70,7 @@ public class AddStagePanel extends JFrame{
|
|||||||
}
|
}
|
||||||
else if ( alreadyExists == false )
|
else if ( alreadyExists == false )
|
||||||
{
|
{
|
||||||
Stage s = new Stage(name,description);
|
AgendaStage s = new AgendaStage(name,description);
|
||||||
agenda.addStage(s);
|
agenda.addStage(s);
|
||||||
JOptionPane.showMessageDialog(null, "Stage added!");
|
JOptionPane.showMessageDialog(null, "Stage added!");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|||||||
+5
-5
@@ -17,17 +17,17 @@ public class Agenda implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1;
|
private static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private ArrayList<Stage> stages;
|
private ArrayList<AgendaStage> stages;
|
||||||
private ArrayList<Event> events;
|
private ArrayList<Event> events;
|
||||||
private ArrayList<Artist> artists;
|
private ArrayList<Artist> artists;
|
||||||
|
|
||||||
public Agenda() {
|
public Agenda() {
|
||||||
stages = new ArrayList<Stage>();
|
stages = new ArrayList<AgendaStage>();
|
||||||
events = new ArrayList<Event>();
|
events = new ArrayList<Event>();
|
||||||
artists = new ArrayList<Artist>();
|
artists = new ArrayList<Artist>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addStage(Stage stage){
|
public void addStage(AgendaStage stage){
|
||||||
stages.add(stage);
|
stages.add(stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public class Agenda implements Serializable {
|
|||||||
{
|
{
|
||||||
return artists;
|
return artists;
|
||||||
}
|
}
|
||||||
public ArrayList<Stage> getStages()
|
public ArrayList<AgendaStage> getStages()
|
||||||
{
|
{
|
||||||
return stages;
|
return stages;
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,7 @@ public class Agenda implements Serializable {
|
|||||||
{
|
{
|
||||||
boolean exists = false;
|
boolean exists = false;
|
||||||
String name = e.getStage().getName();
|
String name = e.getStage().getName();
|
||||||
for (Stage s : stages)
|
for (AgendaStage s : stages)
|
||||||
{
|
{
|
||||||
if ( s.getName().equals(name) ) {
|
if ( s.getName().equals(name) ) {
|
||||||
exists = true;
|
exists = true;
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package Agenda;
|
package Agenda;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class Stage implements Serializable {
|
public class AgendaStage implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1;
|
private static final long serialVersionUID = 1;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public Stage(String name, String description)
|
public AgendaStage(String name, String description)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@@ -221,9 +221,9 @@ public class EditEventPanel extends JFrame{
|
|||||||
|
|
||||||
String stageName = (String)stage2.getSelectedItem();
|
String stageName = (String)stage2.getSelectedItem();
|
||||||
|
|
||||||
Stage stage = null;
|
AgendaStage stage = null;
|
||||||
|
|
||||||
for(Stage s : agenda.getStages())
|
for(AgendaStage s : agenda.getStages())
|
||||||
{
|
{
|
||||||
if (s.getName().equals(stageName))
|
if (s.getName().equals(stageName))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class EditStagePanel extends JFrame{
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1;
|
private static final long serialVersionUID = 1;
|
||||||
|
|
||||||
public EditStagePanel(Agenda agenda, Stage sta)
|
public EditStagePanel(Agenda agenda, AgendaStage sta)
|
||||||
{
|
{
|
||||||
super("Stage editscreen!");
|
super("Stage editscreen!");
|
||||||
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||||
@@ -59,7 +59,7 @@ public class EditStagePanel extends JFrame{
|
|||||||
String description = descriptionTF.getText();
|
String description = descriptionTF.getText();
|
||||||
|
|
||||||
boolean alreadyExists = false;
|
boolean alreadyExists = false;
|
||||||
for (Stage stage : agenda.getStages())
|
for (AgendaStage stage : agenda.getStages())
|
||||||
{
|
{
|
||||||
if (stage.getName().equals(name) && !stage.equals(sta))
|
if (stage.getName().equals(name) && !stage.equals(sta))
|
||||||
{
|
{
|
||||||
@@ -101,10 +101,10 @@ public class EditStagePanel extends JFrame{
|
|||||||
|
|
||||||
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove this stage?", "Remove Stage", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION)
|
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove this stage?", "Remove Stage", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION)
|
||||||
{
|
{
|
||||||
Iterator<Stage> it = agenda.getStages().iterator();
|
Iterator<AgendaStage> it = agenda.getStages().iterator();
|
||||||
while(it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
Stage s = it.next();
|
AgendaStage s = it.next();
|
||||||
if(s.equals(sta))
|
if(s.equals(sta))
|
||||||
{
|
{
|
||||||
it.remove();
|
it.remove();
|
||||||
|
|||||||
+5
-5
@@ -19,13 +19,13 @@ public class Event implements Serializable {
|
|||||||
private int stopHour;
|
private int stopHour;
|
||||||
private int stopMinute;
|
private int stopMinute;
|
||||||
private Artist artist;
|
private Artist artist;
|
||||||
private Stage stage;
|
private AgendaStage stage;
|
||||||
private String description;
|
private String description;
|
||||||
private int expectedPopularity;
|
private int expectedPopularity;
|
||||||
|
|
||||||
public Event(String eventName, int startYear, int startMonth, int startDay,
|
public Event(String eventName, int startYear, int startMonth, int startDay,
|
||||||
int startHour, int startMinute, int endYear, int endMonth,
|
int startHour, int startMinute, int endYear, int endMonth,
|
||||||
int endDay, int endHour, int endMinute, Artist artist, Stage stage,
|
int endDay, int endHour, int endMinute, Artist artist, AgendaStage stage,
|
||||||
String description, int expectedPopularity) {
|
String description, int expectedPopularity) {
|
||||||
this.eventName = eventName;
|
this.eventName = eventName;
|
||||||
this.startDate = new GregorianCalendar(startYear, startMonth - 1,
|
this.startDate = new GregorianCalendar(startYear, startMonth - 1,
|
||||||
@@ -43,7 +43,7 @@ public class Event implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Event(String eventName, GregorianCalendar startDate,
|
public Event(String eventName, GregorianCalendar startDate,
|
||||||
GregorianCalendar endDate, Artist artist, Stage stage,
|
GregorianCalendar endDate, Artist artist, AgendaStage stage,
|
||||||
String description, int expectedPopularity) {
|
String description, int expectedPopularity) {
|
||||||
this.eventName = eventName;
|
this.eventName = eventName;
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
@@ -86,7 +86,7 @@ public class Event implements Serializable {
|
|||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stage getStage() {
|
public AgendaStage getStage() {
|
||||||
return this.stage;
|
return this.stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ public class Event implements Serializable {
|
|||||||
this.expectedPopularity = popularity;
|
this.expectedPopularity = popularity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStage(Stage stage) {
|
public void setStage(AgendaStage stage) {
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class PanelArtSta extends JPanel implements Panel{
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dataStage = new Object[1];
|
dataStage = new Object[1];
|
||||||
dataStage[0] = new Stage("Geen Stages", "Geen Stages");
|
dataStage[0] = new AgendaStage("Geen Stages", "Geen Stages");
|
||||||
stages.setEnabled(false);
|
stages.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,16 @@ 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()
|
||||||
{
|
{
|
||||||
|
|||||||
+19
-3
@@ -28,14 +28,14 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
|
|
||||||
import Agenda.Agenda;
|
import Agenda.Agenda;
|
||||||
import Listeners.WindowFocusListener;
|
import Agenda.AgendaStage;
|
||||||
import Listeners.Mouse;
|
import Listeners.Mouse;
|
||||||
import Listeners.MouseMotion;
|
import Listeners.MouseMotion;
|
||||||
import Listeners.MouseWheel;
|
import Listeners.MouseWheel;
|
||||||
|
import Listeners.WindowFocusListener;
|
||||||
import Objects.DrawObject;
|
import Objects.DrawObject;
|
||||||
import Objects.Entrance;
|
import Objects.Entrance;
|
||||||
import Objects.Food;
|
import Objects.Food;
|
||||||
import Objects.OldPath;
|
|
||||||
import Objects.Path;
|
import Objects.Path;
|
||||||
import Objects.Stage;
|
import Objects.Stage;
|
||||||
import Objects.Toilet;
|
import Objects.Toilet;
|
||||||
@@ -168,7 +168,23 @@ public class Panel extends JPanel implements ActionListener
|
|||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return new Stage(null);
|
ArrayList<AgendaStage> stages = agenda.getStages();
|
||||||
|
Object[] s = new Object[stages.size()];
|
||||||
|
AgendaStage stage = null;
|
||||||
|
if (stages.size() != 0) {
|
||||||
|
for (int i = 0; i < stages.size(); i++) {
|
||||||
|
s[i] = stages.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
stage = (AgendaStage) JOptionPane.showInputDialog(null,
|
||||||
|
"Select the right Stage", "Select Stage",
|
||||||
|
JOptionPane.PLAIN_MESSAGE, null, s, "stage");
|
||||||
|
}
|
||||||
|
if (stage != null){
|
||||||
|
return new Stage(null, stage);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
case 1:
|
case 1:
|
||||||
return new Toilet(null);
|
return new Toilet(null);
|
||||||
case 2:
|
case 2:
|
||||||
|
|||||||
+17
-11
@@ -45,14 +45,17 @@ public class Mouse extends MouseAdapter
|
|||||||
if (e.getX() >= panel.getScrollfactor() && e.getX() < last + image.getWidth() + panel.getScrollfactor())
|
if (e.getX() >= panel.getScrollfactor() && e.getX() < last + image.getWidth() + panel.getScrollfactor())
|
||||||
{
|
{
|
||||||
DrawObject tempDrawObj = panel.createNewDrawObject(i);
|
DrawObject tempDrawObj = panel.createNewDrawObject(i);
|
||||||
tempDrawObj.setPosition(clickPoint);
|
if (tempDrawObj != null)
|
||||||
if (!panel.getObjects().isEmpty())
|
{
|
||||||
panel.clearObjectSelection();
|
tempDrawObj.setPosition(clickPoint);
|
||||||
panel.setDragObject(tempDrawObj);
|
if (!panel.getObjects().isEmpty())
|
||||||
panel.getDragObject().setSelected(true);
|
panel.clearObjectSelection();
|
||||||
panel.getPP().setSelected(tempDrawObj);
|
panel.setDragObject(tempDrawObj);
|
||||||
panel.setSelectedObject(tempDrawObj);
|
panel.getDragObject().setSelected(true);
|
||||||
selectedObject = tempDrawObj;
|
panel.getPP().setSelected(tempDrawObj);
|
||||||
|
panel.setSelectedObject(tempDrawObj);
|
||||||
|
selectedObject = tempDrawObj;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
@@ -71,7 +74,8 @@ public class Mouse extends MouseAdapter
|
|||||||
{
|
{
|
||||||
if (SwingUtilities.isRightMouseButton(e))
|
if (SwingUtilities.isRightMouseButton(e))
|
||||||
{
|
{
|
||||||
if(o instanceof Waypoint){
|
if (o instanceof Waypoint)
|
||||||
|
{
|
||||||
new WaypointPopup(o);
|
new WaypointPopup(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,8 +141,10 @@ public class Mouse extends MouseAdapter
|
|||||||
|
|
||||||
public void mouseReleased(MouseEvent e)
|
public void mouseReleased(MouseEvent e)
|
||||||
{
|
{
|
||||||
if(panel.getDragObject() != null) {
|
if (panel.getDragObject() != null)
|
||||||
if(panel.getDragObject().getRectangleColor() != Color.RED) {
|
{
|
||||||
|
if (panel.getDragObject().getRectangleColor() != Color.RED)
|
||||||
|
{
|
||||||
panel.getDragObject().setPosition(panel.getDragObject().getPosition(), true);
|
panel.getDragObject().setPosition(panel.getDragObject().getPosition(), true);
|
||||||
panel.getPP().update();
|
panel.getPP().update();
|
||||||
panel.setDragObject(null);
|
panel.setDragObject(null);
|
||||||
|
|||||||
+16
-1
@@ -2,11 +2,16 @@ package Objects;
|
|||||||
|
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
|
import Agenda.AgendaStage;
|
||||||
|
|
||||||
public class Stage extends DrawObject
|
public class Stage extends DrawObject
|
||||||
{
|
{
|
||||||
public Stage(Point2D position)
|
AgendaStage stage;
|
||||||
|
|
||||||
|
public Stage(Point2D position, AgendaStage st)
|
||||||
{
|
{
|
||||||
super("stage", position);
|
super("stage", position);
|
||||||
|
stage = st;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -15,4 +20,14 @@ public class Stage extends DrawObject
|
|||||||
return "Stage";
|
return "Stage";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AgendaStage getStage()
|
||||||
|
{
|
||||||
|
return stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStage(AgendaStage stage)
|
||||||
|
{
|
||||||
|
this.stage = stage;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user