Skip to content

Commit

Permalink
EntityComboBoxModel.ForeignKeyFilter.get() added
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorndarri committed Oct 28, 2024
1 parent ff935cf commit 270005a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,15 @@ public void set(Entity.Key key) {

@Override
public void set(Collection<Entity.Key> keys) {
foreignKeys = new HashSet<>(validateKeys(keys));
foreignKeys = unmodifiableSet(new HashSet<>(validateKeys(keys)));
items().filter();
}

@Override
public Collection<Entity.Key> get() {
return foreignKeys == null ? emptySet() : foreignKeys;
}

@Override
public void clear() {
this.foreignKeys = null;
Expand Down Expand Up @@ -400,10 +405,6 @@ else if (strict.get()) {
}
}

private Collection<Entity.Key> get() {
return foreignKeys == null ? emptySet() : foreignKeys;
}

private Collection<Entity.Key> validateKeys(Collection<Entity.Key> keys) {
requireNonNull(keys);
for (Entity.Key key : keys) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ interface ForeignKeyFilter {
*/
void set(Collection<Entity.Key> keys);

/**
* @return the current filter keys
*/
Collection<Entity.Key> get();

/**
* Clears and disables this foreign key filter
*/
Expand Down

0 comments on commit 270005a

Please sign in to comment.