Author: euluis
Date: 2007-11-19 22:25:18-0800
New Revision: 13796
Modified:
trunk/src_new/org/argouml/ui/SettingsDialog.java
Log:
Issue #4916: keep the original GUISettingsTabInterface collection as returned from GUI.getSettingsTabs() at hand for iteration in SettingsDialog.handleSave() and other handlers that iterate along the collection.
Modified: trunk/src_new/org/argouml/ui/SettingsDialog.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/SettingsDialog.java?view=diff&rev=13796&p1=trunk/src_new/org/argouml/ui/SettingsDialog.java&p2=trunk/src_new/org/argouml/ui/SettingsDialog.java&r1=13795&r2=13796
==============================================================================
--- trunk/src_new/org/argouml/ui/SettingsDialog.java (original)
+++ trunk/src_new/org/argouml/ui/SettingsDialog.java 2007-11-19 22:25:18-0800
@@ -29,7 +29,7 @@
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
-import java.util.Iterator;
+import java.util.List;
import javax.swing.JButton;
import javax.swing.JTabbedPane;
@@ -81,11 +81,8 @@
addButton(applyButton);
// Add settings from the settings registry.
- Iterator iter = GUI.getInstance().getSettingsTabs().iterator();
- while (iter.hasNext()) {
- GUISettingsTabInterface stp =
- (GUISettingsTabInterface) iter.next();
-
+ settingsTabs = GUI.getInstance().getSettingsTabs();
+ for (GUISettingsTabInterface stp : settingsTabs) {
tabs.addTab(
Translator.localize(stp.getTabKey()),
stp.getTabPanel());
@@ -136,11 +133,8 @@
* Called when the user has pressed Save. Performs "Save" in all Tabs.
*/
private void handleSave() {
- for (int i = 0; i < tabs.getComponentCount(); i++) {
- Object o = tabs.getComponent(i);
- if (o instanceof GUISettingsTabInterface) {
- ((GUISettingsTabInterface) o).handleSettingsTabSave();
- }
+ for (GUISettingsTabInterface tab : settingsTabs) {
+ tab.handleSettingsTabSave();
}
windowOpen = false;
Configuration.save();
@@ -150,11 +144,8 @@
* Called when the user has pressed Cancel. Performs "Cancel" in all Tabs.
*/
private void handleCancel() {
- for (int i = 0; i < tabs.getComponentCount(); i++) {
- Object o = tabs.getComponent(i);
- if (o instanceof GUISettingsTabInterface) {
- ((GUISettingsTabInterface) o).handleSettingsTabCancel();
- }
+ for (GUISettingsTabInterface tab : settingsTabs) {
+ tab.handleSettingsTabCancel();
}
windowOpen = false;
}
@@ -163,11 +154,8 @@
* Perform "Refresh" in all Tabs.
*/
private void handleRefresh() {
- for (int i = 0; i < tabs.getComponentCount(); i++) {
- Object o = tabs.getComponent(i);
- if (o instanceof GUISettingsTabInterface) {
- ((GUISettingsTabInterface) o).handleSettingsTabRefresh();
- }
+ for (GUISettingsTabInterface tab : settingsTabs) {
+ tab.handleSettingsTabRefresh();
}
}
@@ -233,4 +221,6 @@
* The serial version.
*/
private static final long serialVersionUID = -8233301947357843703L;
+
+ private List<GUISettingsTabInterface> settingsTabs;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.