Fix for changing to different panel on data change.

After data has been edited, the current panel is now updated.
This commit is contained in:
2015-02-26 20:38:57 +01:00
parent 9ee421b792
commit 3ece3588e6
9 changed files with 25 additions and 25 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ public class AddArtistPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Artist added!");
setVisible(false);
dispose();
Window.updatePanel("art_sta");
Window.updatePanel();
} else {
JOptionPane.showMessageDialog(null, "Choose a different artist name!");
}
+1 -1
View File
@@ -248,7 +248,7 @@ public class AddEventPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Event added!");
setVisible(false);
dispose();
Window.updatePanel("table");
Window.updatePanel();
}
+1 -1
View File
@@ -74,7 +74,7 @@ public class AddStagePanel extends JFrame{
JOptionPane.showMessageDialog(null, "Stage added!");
setVisible(false);
dispose();
Window.updatePanel("art_sta");
Window.updatePanel();
}
else {
JOptionPane.showMessageDialog(null, "Choose a different stage name!");
+2 -2
View File
@@ -112,7 +112,7 @@ public class EditArtistPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Artist edited!");
setVisible(false);
dispose();
Window.updatePanel("art_sta");
Window.updatePanel();
} else {
JOptionPane.showMessageDialog(null, "Choose a different artist name!");
}
@@ -149,7 +149,7 @@ public class EditArtistPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Artist removed!");
setVisible(false);
dispose();
Window.updatePanel("art_sta");
Window.updatePanel();
}
}
});
+2 -2
View File
@@ -270,7 +270,7 @@ public class EditEventPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Event edited!");
setVisible(false);
dispose();
Window.updatePanel("table");
Window.updatePanel();
}
@@ -299,7 +299,7 @@ public class EditEventPanel extends JFrame{
JOptionPane.showMessageDialog(null, "Event removed!");
setVisible(false);
dispose();
Window.updatePanel("table");
Window.updatePanel();
}
}
});
+2 -2
View File
@@ -75,7 +75,7 @@ public class EditStagePanel extends JFrame{
JOptionPane.showMessageDialog(null, "Stage edited!");
setVisible(false);
dispose();
Window.updatePanel("art_sta");
Window.updatePanel();
}
else {
JOptionPane.showMessageDialog(null, "Choose a different stage name!");
@@ -113,7 +113,7 @@ public class EditStagePanel extends JFrame{
JOptionPane.showMessageDialog(null, "Stage removed!");
setVisible(false);
dispose();
Window.updatePanel("art_sta");
Window.updatePanel();
}
}
});
+1 -1
View File
@@ -35,7 +35,7 @@ public class Main {
agn.fillArtists();
agn.fillStages();
w.updatePanel("table");
w.updatePanel();
}
}
+6 -6
View File
@@ -53,7 +53,7 @@ public class MenuBar extends JMenuBar {
{
Agenda a = new Agenda();
w.setAgenda(a);
Window.updatePanel("table");
Window.updatePanel();
}
}
});
@@ -63,7 +63,7 @@ public class MenuBar extends JMenuBar {
open.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
w.getAgenda().loadAgenda();
Window.updatePanel("table");
Window.updatePanel();
}
});
@@ -72,7 +72,7 @@ public class MenuBar extends JMenuBar {
save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
w.getAgenda().saveAgenda();
Window.updatePanel("table");
Window.updatePanel();
}
});
@@ -108,21 +108,21 @@ public class MenuBar extends JMenuBar {
JMenuItem timeline = new JMenuItem("Timeline");
timeline.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Window.updatePanel("timeline");
Window.changePanel("timeline");
}
});
JMenuItem table = new JMenuItem("Table");
table.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Window.updatePanel("table");
Window.changePanel("table");
}
});
JMenuItem art_sta = new JMenuItem("Artists and Stages");
art_sta.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Window.updatePanel("art_sta");
Window.changePanel("art_sta");
}
});
+9 -9
View File
@@ -95,7 +95,7 @@ public class Window extends JFrame {
public void actionPerformed(ActionEvent e) {
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) - 7);
dateLabel.setText(formatter.format(date.getTime()));
changePanel();
updatePanel();
}
});
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
@@ -108,7 +108,7 @@ public class Window extends JFrame {
public void actionPerformed(ActionEvent e) {
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) - 1);
dateLabel.setText(formatter.format(date.getTime()));
changePanel();
updatePanel();
}
});
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
@@ -121,7 +121,7 @@ public class Window extends JFrame {
public void actionPerformed(ActionEvent e) {
date = new GregorianCalendar();
dateLabel.setText(formatter.format(date.getTime()));
changePanel();
updatePanel();
}
});
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
@@ -134,7 +134,7 @@ public class Window extends JFrame {
public void actionPerformed(ActionEvent e) {
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) + 1);
dateLabel.setText(formatter.format(date.getTime()));
changePanel();
updatePanel();
}
});
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
@@ -147,7 +147,7 @@ public class Window extends JFrame {
public void actionPerformed(ActionEvent e) {
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) + 7);
dateLabel.setText(formatter.format(date.getTime()));
changePanel();
updatePanel();
}
});
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
@@ -159,19 +159,19 @@ public class Window extends JFrame {
setContentPane(mainPanel);
changePanel();
updatePanel();
//Show window
setVisible(true);
}
public static void updatePanel(String panel)
public static void changePanel(String panel)
{
currentPanel = panel;
changePanel();
updatePanel();
}
private static void changePanel()
public static void updatePanel()
{
centerPanel.removeAll();
Panel p = panels.get(currentPanel);