mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-27 14:58:55 +01:00
Some refactoring. Replaced all "listeners" list by instances of
CopyOnWriteArrayList, to allow listeners to unregister themselves due to an event while preventing ConcurrentModificationExceptions. Modified all GameDataElement.elementChanged concrete implementation to remove the backlink from the oldOne.An element pointed by an altered element will not show the game source element in its backlink list anymore.
This commit is contained in:
@@ -10,6 +10,7 @@ import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
@@ -518,7 +519,7 @@ public class JSONCreationWizard extends JDialog {
|
||||
return DataType.values()[index];
|
||||
}
|
||||
|
||||
List<ListDataListener> listeners = new ArrayList<ListDataListener>();
|
||||
List<ListDataListener> listeners = new CopyOnWriteArrayList<ListDataListener>();
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
@@ -584,7 +585,7 @@ public class JSONCreationWizard extends JDialog {
|
||||
public void elementCreated(JSONElement created);
|
||||
}
|
||||
|
||||
private List<CreationCompletedListener> listeners = new ArrayList<JSONCreationWizard.CreationCompletedListener>();
|
||||
private List<CreationCompletedListener> listeners = new CopyOnWriteArrayList<JSONCreationWizard.CreationCompletedListener>();
|
||||
|
||||
public void addCreationListener(CreationCompletedListener l) {
|
||||
listeners.add(l);
|
||||
|
||||
Reference in New Issue
Block a user