Skip to content

Commit

Permalink
FilterColumnConditionPanel bug fixed, did not link all components to …
Browse files Browse the repository at this point in the history
…locked state
  • Loading branch information
bjorndarri committed Oct 10, 2024
1 parent 14757e2 commit ef3d551
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Codion Change Log
- FilterColumnConditionPanel.Fields added.
- FilterTableColumnModel.Visible and Hidden added, related refactoring.
- FilterTableColumnModel.containsColumn() and resetColumns() renamed contains() and reset() respectively.
- FilterColumnConditionPanel bug fixed, did not link all components to locked state.
### is.codion.framework.domain
- Entity.copy(), copyBuilder() and deepCopy() moved to Entity.Copy, renamed mutable(), builder() and deep() respectively, immutable() added.
- ImmutableEntity bug fixed, StackOverflowError when creating an immutable entity with cyclical foreign key dependencies, some refactoring.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,13 @@ private void showColumn(C identifier) {
}

private void hideColumn(C identifier) {
if (!hiddenColumnMap.containsKey(identifier)) {
hiddenColumnMap.computeIfAbsent(identifier, k -> {
HiddenColumn hiddenColumn = new HiddenColumn(column(identifier));
hiddenColumnMap.put(identifier, hiddenColumn);
tableColumnModel.removeColumn(hiddenColumn.column);
columnHidden.accept(identifier);
}

return hiddenColumn;
});
}

private void checkIfLocked() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,25 +479,22 @@ else if (component instanceof JComboBox) {

private void bindEvents() {
condition().operator().addConsumer(this::onOperatorChanged);
linkToEnabledState(condition().locked().not(),
operatorCombo, equalField, upperBoundField, lowerBoundField, toggleEnabledButton);
components().forEach(component -> component.addFocusListener(new FocusGained()));

Collection<JComponent> fields = Stream.of(operatorCombo, toggleEnabledButton, equalField, upperBoundField, lowerBoundField, inField)
.filter(Objects::nonNull)
.collect(toList());
Collection<JComponent> components = components();
linkToEnabledState(condition().locked().not(), components.toArray(new JComponent[0]));
FocusGained focusGained = new FocusGained();
components.forEach(component -> component.addFocusListener(focusGained));
TOGGLE_ENABLED.defaultKeystroke().optional().ifPresent(keyStroke ->
KeyEvents.builder(keyStroke)
.action(command(this::toggleEnabled))
.enable(fields));
.enable(components));
PREVIOUS_OPERATOR.defaultKeystroke().optional().ifPresent(keyStroke ->
KeyEvents.builder(keyStroke)
.action(command(this::selectPreviousOperator))
.enable(fields));
.enable(components));
NEXT_OPERATOR.defaultKeystroke().optional().ifPresent(keyStroke ->
KeyEvents.builder(keyStroke)
.action(command(this::selectNextOperator))
.enable(fields));
.enable(components));
}

private void onOperatorChanged(Operator operator) {
Expand Down

0 comments on commit ef3d551

Please sign in to comment.