This commit is contained in:
2015-02-27 10:52:26 +01:00
parent 18b9510f04
commit 43e2dca06e
6 changed files with 49 additions and 23 deletions
+2
View File
@@ -211,6 +211,8 @@ public class Agenda implements Serializable {
public void clearAgenda() public void clearAgenda()
{ {
events.clear(); events.clear();
stages.clear();
artists.clear();
} }
public void fillAllLists() public void fillAllLists()
+2 -2
View File
@@ -111,7 +111,7 @@ public class EditArtistPanel extends JFrame {
JOptionPane.showMessageDialog(null, "Artist edited!"); JOptionPane.showMessageDialog(null, "Artist edited!");
setVisible(false); setVisible(false);
dispose(); dispose();
Window.updatePanel("art_sta"); Window.updatePanel();
if(tab != null) if(tab != null)
{ {
tab.setVisible(false); tab.setVisible(false);
@@ -162,7 +162,7 @@ public class EditArtistPanel extends JFrame {
JOptionPane.showMessageDialog(null, "Artist removed!"); JOptionPane.showMessageDialog(null, "Artist removed!");
setVisible(false); setVisible(false);
dispose(); dispose();
Window.updatePanel("art_sta"); Window.updatePanel();
if(tab != null) if(tab != null)
{ {
tab.setVisible(false); tab.setVisible(false);
+3 -3
View File
@@ -270,7 +270,7 @@ public class EditEventPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Event edited!"); JOptionPane.showMessageDialog(null, "Event edited!");
setVisible(false); setVisible(false);
dispose(); dispose();
Window.updatePanel("table"); Window.updatePanel();
if(tab != null) if(tab != null)
{ {
tab.setVisible(false); tab.setVisible(false);
@@ -296,7 +296,7 @@ public class EditEventPanel extends JFrame{
remove.addActionListener(new ActionListener() remove.addActionListener(new ActionListener()
{ {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent f) {
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove this event?", "Remove Event", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove this event?", "Remove Event", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION)
{ {
@@ -313,7 +313,7 @@ public class EditEventPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Event removed!"); JOptionPane.showMessageDialog(null, "Event removed!");
setVisible(false); setVisible(false);
dispose(); dispose();
Window.updatePanel("table"); Window.updatePanel();
if(tab != null) if(tab != null)
{ {
tab.setVisible(false); tab.setVisible(false);
+3 -4
View File
@@ -19,9 +19,9 @@ public class Main {
Event e2 = new Event("Coldplay Live", 2015, 2, 25, 20, 00, 2015, 2, 25, 22, 00, a1, s1, "A concert from a very famous band", 1); Event e2 = new Event("Coldplay Live", 2015, 2, 25, 20, 00, 2015, 2, 25, 22, 00, a1, s1, "A concert from a very famous band", 1);
Event e3 = new Event("Nirvana in memory", 2015, 2, 24, 16, 30, 2015, 2, 24, 20, 45, a2, s1, "A concert in memory of a once very famous band", 4); Event e3 = new Event("Nirvana in memory", 2015, 2, 24, 16, 30, 2015, 2, 24, 20, 45, a2, s1, "A concert in memory of a once very famous band", 4);
Event e4 = new Event("Epic Rap Battles of History", 2015, 3, 3, 12, 30, 2015, 3, 12, 18, 45, a3, s2, "Rap battle with Eminem and ERP", 3); Event e4 = new Event("Epic Rap Battles of History", 2015, 3, 3, 12, 30, 2015, 3, 12, 18, 45, a3, s2, "Rap battle with Eminem and ERP", 3);
Event e5 = new Event("Coldplay Live", 2015, 2, 26, 21, 00, 2015, 2, 24, 23, 00, a1, s1, "A concert from a very famous band", 2); Event e5 = new Event("Coldplay Live", 2015, 2, 26, 21, 00, 2015, 2, 26, 23, 00, a1, s1, "A concert from a very famous band", 2);
Event e6 = new Event("Coldplay Live", 2015, 2, 27, 20, 00, 2015, 2, 25, 22, 00, a1, s1, "A concert from a very famous band", 1); Event e6 = new Event("Coldplay Live", 2015, 2, 27, 20, 00, 2015, 2, 27, 22, 00, a1, s1, "A concert from a very famous band", 1);
Event e7 = new Event("Nirvana in memory", 2015, 2, 28, 16, 30, 2015, 2, 24, 20, 45, a2, s1, "A concert in memory of a once very famous band", 4); Event e7 = new Event("Nirvana in memory", 2015, 2, 28, 16, 30, 2015, 2, 28, 20, 45, a2, s1, "A concert in memory of a once very famous band", 4);
Event e8 = new Event("Epic Rap Battles of History", 2015, 3, 2, 12, 30, 2015, 3, 12, 18, 45, a3, s2, "Rap battle with Eminem and ERP", 3); Event e8 = new Event("Epic Rap Battles of History", 2015, 3, 2, 12, 30, 2015, 3, 12, 18, 45, a3, s2, "Rap battle with Eminem and ERP", 3);
agn.addEvent(e1); agn.addEvent(e1);
@@ -38,7 +38,6 @@ public class Main {
w.updatePanel(); w.updatePanel();
} }
} }
+2 -2
View File
@@ -51,8 +51,8 @@ public class MenuBar extends JMenuBar {
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to create a new agenda?", "New Agenda", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) if(JOptionPane.showConfirmDialog(null, "Are you sure you want to create a new agenda?", "New Agenda", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION)
{ {
Agenda a = new Agenda(); Agenda ag = w.getAgenda();
w.setAgenda(a); ag.clearAgenda();
Window.updatePanel(); Window.updatePanel();
} }
} }
+31 -6
View File
@@ -17,11 +17,13 @@ public class PanelArtSta extends JPanel implements Panel{
JList stages; JList stages;
Object[] dataArtist; Object[] dataArtist;
Object[] dataStage; Object[] dataStage;
Window w;
public PanelArtSta(Window w) public PanelArtSta(Window w)
{ {
super(); super();
a = w.getAgenda(); a = w.getAgenda();
this.w = w;
artists = new JList(); artists = new JList();
artists.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); artists.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
@@ -70,24 +72,47 @@ public class PanelArtSta extends JPanel implements Panel{
public void compileData() public void compileData()
{ {
int artists = a.getArtists().size(); int artistsList = a.getArtists().size();
int stages = a.getStages().size(); int stagesList = a.getStages().size();
dataArtist = new Object[artists];
dataStage = new Object[stages];
for(int i = 0; i < artists; i++) if(artistsList > 0)
{
dataArtist = new Object[artistsList];
for(int i = 0; i < artistsList; i++)
{ {
dataArtist[i] = a.getArtists().get(i); dataArtist[i] = a.getArtists().get(i);
} }
for(int i = 0; i < stages; i++) artists.setEnabled(true);
}
else
{
dataArtist = new Object[1];
dataArtist[0] = new Artist("Geen Artists", "Geen Artists", "null", "Geen Artists", "Geen Artists");
artists.setEnabled(false);
}
if(stagesList > 0)
{
dataStage = new Object[stagesList];
for(int i = 0; i < stagesList; i++)
{ {
dataStage[i] = a.getStages().get(i); dataStage[i] = a.getStages().get(i);
} }
stages.setEnabled(true);
}
else
{
dataStage = new Object[1];
dataStage[0] = new Stage("Geen Stages", "Geen Stages");
stages.setEnabled(false);
}
} }
@Override @Override
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
public void update(ArrayList<Event> event) { public void update(ArrayList<Event> event) {
a = w.getAgenda();
compileData(); compileData();
AbstractListModel artistsList = new ContentList(dataArtist); AbstractListModel artistsList = new ContentList(dataArtist);
AbstractListModel stagesList = new ContentList(dataStage); AbstractListModel stagesList = new ContentList(dataStage);