Top Fields Constructors Methods
org.jabref.gui.groups

public Class GroupTreeViewModel

extends AbstractViewModel
Class Inheritance
Imports
java.util.ArrayList, .Collections, .Comparator, .List, .Objects, .Optional, java.util.function.Predicate, java.util.stream.Collectors, javafx.beans.property.ListProperty, .ObjectProperty, .SimpleListProperty, .SimpleObjectProperty, .SimpleStringProperty, .StringProperty, javafx.collections.FXCollections, .ObservableList, javafx.scene.control.Alert, .ButtonBar, .ButtonType, org.jabref.gui.AbstractViewModel, .DialogService, .StateManager, org.jabref.gui.util.CustomLocalDragboard, .TaskExecutor, org.jabref.logic.l10n.Localization, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, org.jabref.model.groups.AbstractGroup, .AutomaticKeywordGroup, .AutomaticPersonsGroup, .ExplicitGroup, .GroupTreeNode, .RegexKeywordGroup, .SearchGroup, .TexGroup, .WordKeywordGroup, org.jabref.model.metadata.MetaData, org.jabref.preferences.PreferencesService, com.tobiasdiez.easybind.EasyBind

Field Summary

Modifier and TypeField and Description
private final Comparator<GroupTreeNode>
private final Comparator<GroupTreeNode>
private final Comparator<GroupTreeNode>
private final Comparator<GroupTreeNode>
private Optional<BibDatabaseContext>
private final DialogService
private final ObjectProperty<Predicate<GroupNodeViewModel>>
private final StringProperty
private final CustomLocalDragboard
private final PreferencesService
private final ObjectProperty<GroupNodeViewModel>
private final ListProperty<GroupNodeViewModel>
private final StateManager
private final TaskExecutor

Constructor Summary

AccessConstructor and Description
public
GroupTreeViewModel(StateManager stateManager, DialogService dialogService, PreferencesService preferencesService, TaskExecutor taskExecutor, CustomLocalDragboard localDragboard)

Method Summary

Modifier and TypeMethod and Description
public void
addNewGroupToRoot()

Opens "New Group Dialog" and add the resulting group to the root

public void
addNewSubgroup(GroupNodeViewModel parent, GroupDialogHeader groupDialogHeader)

Opens "New Group Dialog" and adds the resulting group as subgroup to the specified group

public void
public void
editGroup(GroupNodeViewModel oldGroup)

Opens "Edit Group Dialog" and changes the given group to the edited one.

public ObjectProperty<Predicate<GroupNodeViewModel>>
public StringProperty
private boolean
private void
onActiveDatabaseChanged(Optional<BibDatabaseContext> newDatabase)

Gets invoked if the user changes the active database.

pack-priv boolean

Returns:

true if just trivial modifications (e.g. color or description) or the relevant group properties are equal, false otherwise
onlyMinorChanges
(AbstractGroup
Original Group
oldGroup
,
AbstractGroup
Edited group
newGroup
)

Check if it is necessary to show a group modified, reassign entry dialog Group name change is handled separately

private void
onSelectedGroupChanged(ObservableList<GroupNodeViewModel> newValue)

Gets invoked if the user selects a different group.

private void
public void
removeGroupAndSubgroups(GroupNodeViewModel group)

Removes the specified group and its subgroups (after asking for confirmation).

public void
public void
removeGroupNoSubgroups(GroupNodeViewModel group)

Removes the specified group (after asking for confirmation).

pack-priv void
public void
public void
public ObjectProperty<GroupNodeViewModel>
public ListProperty<GroupNodeViewModel>
public void
public void
public void
public void
public void

Field Detail

compAlphabetIgnoreCaseback to summary
private final Comparator<GroupTreeNode> compAlphabetIgnoreCase
compAlphabetIgnoreCaseReverseback to summary
private final Comparator<GroupTreeNode> compAlphabetIgnoreCaseReverse
compEntriesback to summary
private final Comparator<GroupTreeNode> compEntries
compEntriesReverseback to summary
private final Comparator<GroupTreeNode> compEntriesReverse
currentDatabaseback to summary
private Optional<BibDatabaseContext> currentDatabase
dialogServiceback to summary
private final DialogService dialogService
filterPredicateback to summary
private final ObjectProperty<Predicate<GroupNodeViewModel>> filterPredicate
filterTextback to summary
private final StringProperty filterText
localDragboardback to summary
private final CustomLocalDragboard localDragboard
preferencesback to summary
private final PreferencesService preferences
rootGroupback to summary
private final ObjectProperty<GroupNodeViewModel> rootGroup
selectedGroupsback to summary
private final ListProperty<GroupNodeViewModel> selectedGroups
stateManagerback to summary
private final StateManager stateManager
taskExecutorback to summary
private final TaskExecutor taskExecutor

Constructor Detail

GroupTreeViewModelback to summary
public GroupTreeViewModel(StateManager stateManager, DialogService dialogService, PreferencesService preferencesService, TaskExecutor taskExecutor, CustomLocalDragboard localDragboard)

Method Detail

addNewGroupToRootback to summary
public void addNewGroupToRoot()

Opens "New Group Dialog" and add the resulting group to the root

addNewSubgroupback to summary
public void addNewSubgroup(GroupNodeViewModel parent, GroupDialogHeader groupDialogHeader)

Opens "New Group Dialog" and adds the resulting group as subgroup to the specified group

addSelectedEntriesback to summary
public void addSelectedEntries(GroupNodeViewModel group)
editGroupback to summary
public void editGroup(GroupNodeViewModel oldGroup)

Opens "Edit Group Dialog" and changes the given group to the edited one.

filterPredicatePropertyback to summary
public ObjectProperty<Predicate<GroupNodeViewModel>> filterPredicateProperty()
filterTextPropertyback to summary
public StringProperty filterTextProperty()
isGroupTypeEqualback to summary
private boolean isGroupTypeEqual(AbstractGroup oldGroup, AbstractGroup newGroup)
onActiveDatabaseChangedback to summary
private void onActiveDatabaseChanged(Optional<BibDatabaseContext> newDatabase)

Gets invoked if the user changes the active database. We need to get the new group tree and update the view

onlyMinorChangesback to summary
pack-priv boolean onlyMinorChanges(AbstractGroup oldGroup, AbstractGroup newGroup)

Check if it is necessary to show a group modified, reassign entry dialog
Group name change is handled separately

Parameters
oldGroup:AbstractGroup

Original Group

newGroup:AbstractGroup

Edited group

Returns:boolean

true if just trivial modifications (e.g. color or description) or the relevant group properties are equal, false otherwise

onSelectedGroupChangedback to summary
private void onSelectedGroupChanged(ObservableList<GroupNodeViewModel> newValue)

Gets invoked if the user selects a different group. We need to notify the StateManager about this change so that the main table gets updated.

refreshback to summary
private void refresh()
removeGroupAndSubgroupsback to summary
public void removeGroupAndSubgroups(GroupNodeViewModel group)

Removes the specified group and its subgroups (after asking for confirmation).

removeGroupKeepSubgroupsback to summary
public void removeGroupKeepSubgroups(GroupNodeViewModel group)
removeGroupNoSubgroupsback to summary
public void removeGroupNoSubgroups(GroupNodeViewModel group)

Removes the specified group (after asking for confirmation).

removeGroupsAndSubGroupsFromEntriesback to summary
pack-priv void removeGroupsAndSubGroupsFromEntries(GroupNodeViewModel group)
removeSelectedEntriesback to summary
public void removeSelectedEntries(GroupNodeViewModel group)
removeSubgroupsback to summary
public void removeSubgroups(GroupNodeViewModel group)
rootGroupPropertyback to summary
public ObjectProperty<GroupNodeViewModel> rootGroupProperty()
selectedGroupsPropertyback to summary
public ListProperty<GroupNodeViewModel> selectedGroupsProperty()
sortAlphabeticallyRecursiveback to summary
public void sortAlphabeticallyRecursive(GroupTreeNode group)
sortEntriesRecursiveback to summary
public void sortEntriesRecursive(GroupTreeNode group)
sortReverseAlphabeticallyRecursiveback to summary
public void sortReverseAlphabeticallyRecursive(GroupTreeNode group)
sortReverseEntriesRecursiveback to summary
public void sortReverseEntriesRecursive(GroupTreeNode group)
writeGroupChangesToMetaDataback to summary
public void writeGroupChangesToMetaData()