made setting key list unmodifiable

This commit is contained in:
hneemann 2016-05-11 18:30:39 +02:00
parent f8bbd1069a
commit 8210cf0041
2 changed files with 11 additions and 6 deletions

View File

@ -10,21 +10,26 @@ import de.neemann.digital.draw.elements.Circuit;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/** /**
* The Settings of Digital * The Settings of Digital
* <p/> * <p>
* Created by Helmut.Neemann on 11.05.2016. * Created by Helmut.Neemann on 11.05.2016.
*/ */
public final class Settings implements AttributeListener { public final class Settings implements AttributeListener {
private static final List<Key> INT_LIST = new ArrayList<>();
/** /**
* The list of supported attributes. * The list of supported attributes.
*/ */
public static final ArrayList<Key> SETTINGS_KEYS = new ArrayList<>(); public static final List<Key> SETTINGS_KEYS = Collections.unmodifiableList(INT_LIST);
static { static {
SETTINGS_KEYS.add(Keys.SETTINGS_IEEE_SHAPES); INT_LIST.add(Keys.SETTINGS_IEEE_SHAPES);
} }
private static final class SettingsHolder { private static final class SettingsHolder {

View File

@ -15,7 +15,7 @@ import java.util.ArrayList;
*/ */
public class AttributeDialog extends JDialog { public class AttributeDialog extends JDialog {
private final ArrayList<EditorHolder> editors; private final java.util.List<EditorHolder> editors;
private boolean changed = false; private boolean changed = false;
/** /**
@ -25,7 +25,7 @@ public class AttributeDialog extends JDialog {
* @param list the list of keys which are to edit * @param list the list of keys which are to edit
* @param elementAttributes the data stored * @param elementAttributes the data stored
*/ */
public AttributeDialog(Component parent, ArrayList<Key> list, ElementAttributes elementAttributes) { public AttributeDialog(Component parent, java.util.List<Key> list, ElementAttributes elementAttributes) {
this(parent, null, list, elementAttributes); this(parent, null, list, elementAttributes);
} }
@ -37,7 +37,7 @@ public class AttributeDialog extends JDialog {
* @param list the list of keys which are to edit * @param list the list of keys which are to edit
* @param elementAttributes the data stored * @param elementAttributes the data stored
*/ */
public AttributeDialog(Component parent, Point pos, ArrayList<Key> list, ElementAttributes elementAttributes) { public AttributeDialog(Component parent, Point pos, java.util.List<Key> list, ElementAttributes elementAttributes) {
super(SwingUtilities.getWindowAncestor(parent), Lang.get("attr_dialogTitle"), ModalityType.APPLICATION_MODAL); super(SwingUtilities.getWindowAncestor(parent), Lang.get("attr_dialogTitle"), ModalityType.APPLICATION_MODAL);
setDefaultCloseOperation(DISPOSE_ON_CLOSE); setDefaultCloseOperation(DISPOSE_ON_CLOSE);