Skip to content
Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where filled and empty rating stars were hard to distinguish in dark and colored themes. [#17819](https://github.com/JabRef/jabref/issues/17819)
- We fixed the `IfPlural` export formatter treating organizations containing “and” as multiple editors. [#17780](https://github.com/JabRef/jabref/issues/17780)
- We fixed an issue where the DocBook export wrote invalid XML for emoji and some math symbols. [#17747](https://github.com/JabRef/jabref/issues/17747)
- We fixed an issue where assigning a color to a group did not update all affected entries. [#7325](https://github.com/JabRef/jabref/issues/7325)
- We fixed an issue where clicking "Generate" in the AUX file import dialog before parsing caused an exception.
- We fixed an issue where it was hard to distinguish between enabled/disabled status of search buttons in dark mode and added tooltips. [#11569](https://github.com/JabRef/jabref/issues/11569)
- We fixed an issue where entries containing dollar signs, backslashes, or unset fields passed to `substring$` caused citation style preview and export to fail. [#12799](https://github.com/JabRef/jabref/issues/12799)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public ObjectProperty<AbstractGroup> getGroupProperty() {
/// @param newGroup the new group (has to be non-null)
public void setGroup(@NonNull AbstractGroup newGroup) {
this.groupProperty.set(newGroup);
notifyAboutDescendantChange(this);
}

/// Associates the specified group with this node while also providing the possibility to modify previous matched entries so that they are now matched by the new group.
Expand Down Expand Up @@ -91,6 +92,7 @@ public List<FieldChange> setGroup(@NonNull AbstractGroup newGroup,
changes.addAll(entryChanger.add(entriesMatchedByOldGroup));
}
}
notifyAboutDescendantChange(this);
return changes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;

import org.jabref.model.FieldChange;
import org.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -207,6 +208,21 @@ void setGroupChangesUnderlyingGroup() {
assertEquals(newGroup, node.getGroup());
}

@Test
void setGroupNotifiesParentAboutDescendantChange() {
GroupTreeNode root = GroupTreeNode.fromGroup(
new ExplicitGroup("Root", GroupHierarchyType.INDEPENDENT, ','));
GroupTreeNode child = root.addSubgroup(
new ExplicitGroup("OldGroup", GroupHierarchyType.INDEPENDENT, ','));

AtomicInteger descendantChanges = new AtomicInteger();
root.subscribeToDescendantChanged(_ -> descendantChanges.incrementAndGet());

child.setGroup(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about this test

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the 1-arg child.setGroup(newGroup)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested changes have been done.

new ExplicitGroup("NewGroup", GroupHierarchyType.INDEPENDENT, ','));
assertEquals(1, descendantChanges.get());
}

@Test
void setGroupAddsPreviousAssignmentsExplicitToExplicit() {
ExplicitGroup oldGroup = new ExplicitGroup("OldGroup", GroupHierarchyType.INDEPENDENT, ',');
Expand Down
Loading