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()
{
events.clear();
stages.clear();
artists.clear();
}
public void fillAllLists()
+2 -2
View File
@@ -111,7 +111,7 @@ public class EditArtistPanel extends JFrame {
JOptionPane.showMessageDialog(null, "Artist edited!");
setVisible(false);
dispose();
Window.updatePanel("art_sta");
Window.updatePanel();
if(tab != null)
{
tab.setVisible(false);
@@ -162,7 +162,7 @@ public class EditArtistPanel extends JFrame {
JOptionPane.showMessageDialog(null, "Artist removed!");
setVisible(false);
dispose();
Window.updatePanel("art_sta");
Window.updatePanel();
if(tab != null)
{
tab.setVisible(false);
+5 -5
View File
@@ -270,7 +270,7 @@ public class EditEventPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Event edited!");
setVisible(false);
dispose();
Window.updatePanel("table");
Window.updatePanel();
if(tab != null)
{
tab.setVisible(false);
@@ -296,7 +296,7 @@ public class EditEventPanel extends JFrame{
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)
{
@@ -313,11 +313,11 @@ public class EditEventPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Event removed!");
setVisible(false);
dispose();
Window.updatePanel("table");
Window.updatePanel();
if(tab != null)
{
tab.setVisible(false);
tab.dispose();
tab.setVisible(false);
tab.dispose();
}
}
}
+5 -6
View File
@@ -5,7 +5,7 @@ public class Main {
public static void main(String[] args) {
//new Window();
Window w = new Window();
Agenda agn = w.getAgenda();
@@ -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 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 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 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 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 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, 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, 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);
agn.addEvent(e1);
@@ -37,8 +37,7 @@ public class Main {
agn.fillStages();
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)
{
Agenda a = new Agenda();
w.setAgenda(a);
Agenda ag = w.getAgenda();
ag.clearAgenda();
Window.updatePanel();
}
}
+33 -8
View File
@@ -17,11 +17,13 @@ public class PanelArtSta extends JPanel implements Panel{
JList stages;
Object[] dataArtist;
Object[] dataStage;
Window w;
public PanelArtSta(Window w)
{
super();
a = w.getAgenda();
this.w = w;
artists = new JList();
artists.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
@@ -70,24 +72,47 @@ public class PanelArtSta extends JPanel implements Panel{
public void compileData()
{
int artists = a.getArtists().size();
int stages = a.getStages().size();
dataArtist = new Object[artists];
dataStage = new Object[stages];
int artistsList = a.getArtists().size();
int stagesList = a.getStages().size();
for(int i = 0; i < artists; i++)
if(artistsList > 0)
{
dataArtist[i] = a.getArtists().get(i);
dataArtist = new Object[artistsList];
for(int i = 0; i < artistsList; i++)
{
dataArtist[i] = a.getArtists().get(i);
}
artists.setEnabled(true);
}
for(int i = 0; i < stages; i++)
else
{
dataStage[i] = a.getStages().get(i);
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);
}
stages.setEnabled(true);
}
else
{
dataStage = new Object[1];
dataStage[0] = new Stage("Geen Stages", "Geen Stages");
stages.setEnabled(false);
}
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void update(ArrayList<Event> event) {
a = w.getAgenda();
compileData();
AbstractListModel artistsList = new ContentList(dataArtist);
AbstractListModel stagesList = new ContentList(dataStage);