diff --git a/changelog.md b/changelog.md index cf22d83339..7016d6e700 100644 --- a/changelog.md +++ b/changelog.md @@ -26,6 +26,7 @@ Codion Change Log - EntityComboBoxModel.ForeignKeyFilter.set() overloaded for a single Key. - EntityComboBoxModel.Builder.comparator() added. - DefaultEntityComboBoxModel.SelectedItemTranslator removed. +- EntityComboBoxModel.ForeignKeyFilter.get() added. ### is.codion.swing.framework.ui - EntityApplicationPanel now disposes all windows on exit. - EntityTablePanel, row limit configuration field now selects all on focus gained. diff --git a/swing/framework-model/src/main/java/is/codion/swing/framework/model/component/DefaultEntityComboBoxModel.java b/swing/framework-model/src/main/java/is/codion/swing/framework/model/component/DefaultEntityComboBoxModel.java index 8b85a2e3ad..ef0116c3af 100644 --- a/swing/framework-model/src/main/java/is/codion/swing/framework/model/component/DefaultEntityComboBoxModel.java +++ b/swing/framework-model/src/main/java/is/codion/swing/framework/model/component/DefaultEntityComboBoxModel.java @@ -337,10 +337,15 @@ public void set(Entity.Key key) { @Override public void set(Collection keys) { - foreignKeys = new HashSet<>(validateKeys(keys)); + foreignKeys = unmodifiableSet(new HashSet<>(validateKeys(keys))); items().filter(); } + @Override + public Collection get() { + return foreignKeys == null ? emptySet() : foreignKeys; + } + @Override public void clear() { this.foreignKeys = null; @@ -400,10 +405,6 @@ else if (strict.get()) { } } - private Collection get() { - return foreignKeys == null ? emptySet() : foreignKeys; - } - private Collection validateKeys(Collection keys) { requireNonNull(keys); for (Entity.Key key : keys) { diff --git a/swing/framework-model/src/main/java/is/codion/swing/framework/model/component/EntityComboBoxModel.java b/swing/framework-model/src/main/java/is/codion/swing/framework/model/component/EntityComboBoxModel.java index c696ca6882..fd2ea5781f 100644 --- a/swing/framework-model/src/main/java/is/codion/swing/framework/model/component/EntityComboBoxModel.java +++ b/swing/framework-model/src/main/java/is/codion/swing/framework/model/component/EntityComboBoxModel.java @@ -222,6 +222,11 @@ interface ForeignKeyFilter { */ void set(Collection keys); + /** + * @return the current filter keys + */ + Collection get(); + /** * Clears and disables this foreign key filter */