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:
+1
-1
@@ -108,7 +108,7 @@ public class AddArtistPanel extends JFrame{
|
|||||||
JOptionPane.showMessageDialog(null, "Artist added!");
|
JOptionPane.showMessageDialog(null, "Artist added!");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
dispose();
|
dispose();
|
||||||
Window.updatePanel("art_sta");
|
Window.updatePanel();
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(null, "Choose a different artist name!");
|
JOptionPane.showMessageDialog(null, "Choose a different artist name!");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -248,7 +248,7 @@ public class AddEventPanel extends JFrame{
|
|||||||
JOptionPane.showMessageDialog(null, "Event added!");
|
JOptionPane.showMessageDialog(null, "Event added!");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
dispose();
|
dispose();
|
||||||
Window.updatePanel("table");
|
Window.updatePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ public class AddStagePanel extends JFrame{
|
|||||||
JOptionPane.showMessageDialog(null, "Stage added!");
|
JOptionPane.showMessageDialog(null, "Stage added!");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
dispose();
|
dispose();
|
||||||
Window.updatePanel("art_sta");
|
Window.updatePanel();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JOptionPane.showMessageDialog(null, "Choose a different stage name!");
|
JOptionPane.showMessageDialog(null, "Choose a different stage name!");
|
||||||
|
|||||||
@@ -112,7 +112,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();
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(null, "Choose a different artist name!");
|
JOptionPane.showMessageDialog(null, "Choose a different artist name!");
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -299,7 +299,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -75,7 +75,7 @@ public class EditStagePanel extends JFrame{
|
|||||||
JOptionPane.showMessageDialog(null, "Stage edited!");
|
JOptionPane.showMessageDialog(null, "Stage edited!");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
dispose();
|
dispose();
|
||||||
Window.updatePanel("art_sta");
|
Window.updatePanel();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JOptionPane.showMessageDialog(null, "Choose a different stage name!");
|
JOptionPane.showMessageDialog(null, "Choose a different stage name!");
|
||||||
@@ -113,7 +113,7 @@ public class EditStagePanel extends JFrame{
|
|||||||
JOptionPane.showMessageDialog(null, "Stage removed!");
|
JOptionPane.showMessageDialog(null, "Stage removed!");
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
dispose();
|
dispose();
|
||||||
Window.updatePanel("art_sta");
|
Window.updatePanel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class Main {
|
|||||||
|
|
||||||
agn.fillArtists();
|
agn.fillArtists();
|
||||||
agn.fillStages();
|
agn.fillStages();
|
||||||
w.updatePanel("table");
|
w.updatePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -53,7 +53,7 @@ public class MenuBar extends JMenuBar {
|
|||||||
{
|
{
|
||||||
Agenda a = new Agenda();
|
Agenda a = new Agenda();
|
||||||
w.setAgenda(a);
|
w.setAgenda(a);
|
||||||
Window.updatePanel("table");
|
Window.updatePanel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -63,7 +63,7 @@ public class MenuBar extends JMenuBar {
|
|||||||
open.addActionListener(new ActionListener() {
|
open.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
w.getAgenda().loadAgenda();
|
w.getAgenda().loadAgenda();
|
||||||
Window.updatePanel("table");
|
Window.updatePanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ public class MenuBar extends JMenuBar {
|
|||||||
save.addActionListener(new ActionListener() {
|
save.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
w.getAgenda().saveAgenda();
|
w.getAgenda().saveAgenda();
|
||||||
Window.updatePanel("table");
|
Window.updatePanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -108,21 +108,21 @@ public class MenuBar extends JMenuBar {
|
|||||||
JMenuItem timeline = new JMenuItem("Timeline");
|
JMenuItem timeline = new JMenuItem("Timeline");
|
||||||
timeline.addActionListener(new ActionListener() {
|
timeline.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Window.updatePanel("timeline");
|
Window.changePanel("timeline");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
JMenuItem table = new JMenuItem("Table");
|
JMenuItem table = new JMenuItem("Table");
|
||||||
table.addActionListener(new ActionListener() {
|
table.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Window.updatePanel("table");
|
Window.changePanel("table");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
JMenuItem art_sta = new JMenuItem("Artists and Stages");
|
JMenuItem art_sta = new JMenuItem("Artists and Stages");
|
||||||
art_sta.addActionListener(new ActionListener() {
|
art_sta.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Window.updatePanel("art_sta");
|
Window.changePanel("art_sta");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -95,7 +95,7 @@ public class Window extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) - 7);
|
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) - 7);
|
||||||
dateLabel.setText(formatter.format(date.getTime()));
|
dateLabel.setText(formatter.format(date.getTime()));
|
||||||
changePanel();
|
updatePanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
||||||
@@ -108,7 +108,7 @@ public class Window extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) - 1);
|
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) - 1);
|
||||||
dateLabel.setText(formatter.format(date.getTime()));
|
dateLabel.setText(formatter.format(date.getTime()));
|
||||||
changePanel();
|
updatePanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
||||||
@@ -121,7 +121,7 @@ public class Window extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
date = new GregorianCalendar();
|
date = new GregorianCalendar();
|
||||||
dateLabel.setText(formatter.format(date.getTime()));
|
dateLabel.setText(formatter.format(date.getTime()));
|
||||||
changePanel();
|
updatePanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
||||||
@@ -134,7 +134,7 @@ public class Window extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) + 1);
|
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) + 1);
|
||||||
dateLabel.setText(formatter.format(date.getTime()));
|
dateLabel.setText(formatter.format(date.getTime()));
|
||||||
changePanel();
|
updatePanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
||||||
@@ -147,7 +147,7 @@ public class Window extends JFrame {
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) + 7);
|
date.set(GregorianCalendar.DAY_OF_MONTH, date.get(GregorianCalendar.DAY_OF_MONTH) + 7);
|
||||||
dateLabel.setText(formatter.format(date.getTime()));
|
dateLabel.setText(formatter.format(date.getTime()));
|
||||||
changePanel();
|
updatePanel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
bottomPanel.add(new JSeparator(SwingConstants.VERTICAL));
|
||||||
@@ -159,19 +159,19 @@ public class Window extends JFrame {
|
|||||||
|
|
||||||
setContentPane(mainPanel);
|
setContentPane(mainPanel);
|
||||||
|
|
||||||
changePanel();
|
updatePanel();
|
||||||
|
|
||||||
//Show window
|
//Show window
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updatePanel(String panel)
|
public static void changePanel(String panel)
|
||||||
{
|
{
|
||||||
currentPanel = panel;
|
currentPanel = panel;
|
||||||
changePanel();
|
updatePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void changePanel()
|
public static void updatePanel()
|
||||||
{
|
{
|
||||||
centerPanel.removeAll();
|
centerPanel.removeAll();
|
||||||
Panel p = panels.get(currentPanel);
|
Panel p = panels.get(currentPanel);
|
||||||
|
|||||||
Reference in New Issue
Block a user