Browse Source

Update menu whenever the selected character is updated

master
Chris Smith 15 years ago
parent
commit
27d7ced52e

+ 13
- 1
src/uk/co/md87/evetool/ui/MainWindow.java View File

44
 import uk.co.md87.evetool.ConfigManager;
44
 import uk.co.md87.evetool.ConfigManager;
45
 import uk.co.md87.evetool.ui.ContentPanel.Page;
45
 import uk.co.md87.evetool.ui.ContentPanel.Page;
46
 import uk.co.md87.evetool.ui.data.AccountChar;
46
 import uk.co.md87.evetool.ui.data.AccountChar;
47
+import uk.co.md87.evetool.ui.listable.Listable;
48
+import uk.co.md87.evetool.ui.listable.UpdateListener;
47
 import uk.co.md87.evetool.ui.pages.OverviewPage;
49
 import uk.co.md87.evetool.ui.pages.OverviewPage;
48
 import uk.co.md87.evetool.ui.pages.ShipsPage;
50
 import uk.co.md87.evetool.ui.pages.ShipsPage;
49
 import uk.co.md87.evetool.ui.pages.SkillPage;
51
 import uk.co.md87.evetool.ui.pages.SkillPage;
53
  * TODO: Document MainWindow
55
  * TODO: Document MainWindow
54
  * @author chris
56
  * @author chris
55
  */
57
  */
56
-public class MainWindow extends JFrame {
58
+public class MainWindow extends JFrame implements UpdateListener {
57
 
59
 
58
     /**
60
     /**
59
      * A version number for this class. It should be changed whenever the class
61
      * A version number for this class. It should be changed whenever the class
126
     }
128
     }
127
 
129
 
128
     public void setSelectedChar(final AccountChar newChar) {
130
     public void setSelectedChar(final AccountChar newChar) {
131
+        if (selectedChar != null) {
132
+            selectedChar.removeUpdateListener(this);
133
+        }
134
+
129
         selectedChar = newChar;
135
         selectedChar = newChar;
130
 
136
 
137
+        selectedChar.addUpdateListener(this);
138
+
131
         for (Page page : pages.values()) {
139
         for (Page page : pages.values()) {
132
             page.setActiveChar(newChar);
140
             page.setActiveChar(newChar);
133
         }
141
         }
149
         add(new StatusPanel(this), "growx, span, height 30!");
157
         add(new StatusPanel(this), "growx, span, height 30!");
150
     }
158
     }
151
 
159
 
160
+    public void listableUpdated(Listable listable) {
161
+        menuPanel.setSelectedChar(selectedChar);
162
+    }
163
+
152
 }
164
 }

+ 4
- 0
src/uk/co/md87/evetool/ui/data/AccountChar.java View File

86
                         sheet.getResult().getSkillPoints()
86
                         sheet.getResult().getSkillPoints()
87
                         - sheet.getResult().getClone().getSpLimit()));
87
                         - sheet.getResult().getClone().getSpLimit()));
88
             }
88
             }
89
+
90
+            fireUpdateListener();
89
         } else {
91
         } else {
90
             this.balance.setText("(Error)");
92
             this.balance.setText("(Error)");
91
         }
93
         }
95
         this.training = training;
97
         this.training = training;
96
 
98
 
97
         updateSkillInfo(true);
99
         updateSkillInfo(true);
100
+
101
+        fireUpdateListener();
98
     }
102
     }
99
 
103
 
100
     public synchronized void updateSkillInfo(final boolean initial) {
104
     public synchronized void updateSkillInfo(final boolean initial) {

Loading…
Cancel
Save