-
- Notifications
You must be signed in to change notification settings - Fork 3k
Right click create group #11476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Right click create group #11476
Changes from 31 commits
910c857 cbc0d7d f126974 e4c2281 9b4d2db 9631067 d4222a7 faca154 ca5e69f 3a6037e 8dd474a 12dedd4 2c87cda f3011ed 53f1544 ec9b081 aabb4a3 f654aba d772aaa d3e1f1e e4ec775 fd088d1 e2ad784 cf33b73 85d42b9 ea49e46 00de24b a1dfe75 77f927b f80e515 c5241f0 bba0522 1912281 4931eac f928a36 93f2df5 0367f7b e87af8e File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -2,12 +2,12 @@ | |
| | ||
| import java.io.IOException; | ||
| import java.nio.file.Path; | ||
| import java.util.Collections; | ||
| import java.util.Comparator; | ||
| import java.util.List; | ||
| import java.util.function.Supplier; | ||
| import java.util.stream.Collectors; | ||
| | ||
| import javafx.collections.FXCollections; | ||
| import javafx.stage.FileChooser; | ||
| import javafx.util.Duration; | ||
| | ||
| | @@ -111,7 +111,7 @@ private void export(Path file, FileChooser.ExtensionFilter selectedExtensionFilt | |
| // All entries | ||
| entries = stateManager.getActiveDatabase() | ||
| .map(BibDatabaseContext::getEntries) | ||
| .orElse(Collections.emptyList()); | ||
| Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change needed? I checked the caller - and it seems it is passed to I would even try to use Contributor Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe I just did this because the function signature changed (from Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will just revert and see if the CI is green. Reason: BibDatbase context code: public List<BibEntry> getEntries() { return database.getEntries(); } Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did my revert go through, because I did not see it? Please double check that this file is not changed! Contributor Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per my earlier comment -
| ||
| .orElse(FXCollections.emptyObservableList()); | ||
| } | ||
| | ||
| List<Path> fileDirForDatabase = stateManager.getActiveDatabase() | ||
| | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -102,6 +102,9 @@ | |
| </VBox> | ||
| <Separator orientation="VERTICAL"/> | ||
| <StackPane HBox.hgrow="ALWAYS"> | ||
| <VBox visible="${explicitRadioButton.selected}" spacing="10.0"> | ||
| <CheckBox fx:id="explicitIncludeSelected" text="%Include selected entries in new subgroup"/> | ||
m-peeler marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
| </VBox> | ||
| Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this, we do not need the additional context menu entry in the context menu of the group dialog. Please add a screenshot. Reason: There are interested persons scrolling through PRs only. they cannot read the code and imagine what has changed. You make life easier for those (and also for reviewers) if you add updated screenshots! Contributor Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. | ||
| <VBox visible="${keywordsRadioButton.selected}" spacing="10.0"> | ||
| <VBox> | ||
| <Label text="%Field"/> | ||
| | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -25,6 +25,7 @@ | |
| | ||
| import org.jabref.gui.DialogService; | ||
| import org.jabref.gui.icon.IconTheme; | ||
| import org.jabref.gui.maintable.Selection; | ||
| import org.jabref.gui.util.FileDialogConfiguration; | ||
| import org.jabref.logic.auxparser.DefaultAuxParser; | ||
| import org.jabref.logic.groups.DefaultGroupsFactory; | ||
| | @@ -33,6 +34,7 @@ | |
| import org.jabref.logic.util.io.FileUtil; | ||
| import org.jabref.model.database.BibDatabase; | ||
| import org.jabref.model.database.BibDatabaseContext; | ||
| import org.jabref.model.entry.BibEntry; | ||
| import org.jabref.model.entry.Keyword; | ||
| import org.jabref.model.entry.field.FieldFactory; | ||
| import org.jabref.model.groups.AbstractGroup; | ||
| | @@ -77,12 +79,15 @@ public class GroupDialogViewModel { | |
| private final BooleanProperty typeAutoProperty = new SimpleBooleanProperty(); | ||
| private final BooleanProperty typeTexProperty = new SimpleBooleanProperty(); | ||
| | ||
| // Explicit Groups | ||
| private final BooleanProperty explicitIncludeSelectedProperty = new SimpleBooleanProperty(false); | ||
| | ||
| // Option Groups | ||
| private final StringProperty keywordGroupSearchTermProperty = new SimpleStringProperty(""); | ||
| private final StringProperty keywordGroupSearchFieldProperty = new SimpleStringProperty(""); | ||
| private final BooleanProperty keywordGroupCaseSensitiveProperty = new SimpleBooleanProperty(); | ||
| private final BooleanProperty keywordGroupRegexProperty = new SimpleBooleanProperty(); | ||
| | ||
| private final StringProperty searchGroupSearchTermProperty = new SimpleStringProperty(""); | ||
| private final ObjectProperty<EnumSet<SearchFlags>> searchFlagsProperty = new SimpleObjectProperty<>(EnumSet.noneOf(SearchFlags.class)); | ||
| | ||
| | @@ -112,24 +117,42 @@ public class GroupDialogViewModel { | |
| private final AbstractGroup editedGroup; | ||
| private final GroupTreeNode parentNode; | ||
| private final FileUpdateMonitor fileUpdateMonitor; | ||
| private final List<BibEntry> selectedEntries; | ||
| private final Selection includeSelectedEntries; | ||
| | ||
| public GroupDialogViewModel(DialogService dialogService, | ||
| BibDatabaseContext currentDatabase, | ||
| PreferencesService preferencesService, | ||
| @Nullable AbstractGroup editedGroup, | ||
| @Nullable GroupTreeNode parentNode, | ||
| FileUpdateMonitor fileUpdateMonitor) { | ||
| FileUpdateMonitor fileUpdateMonitor, | ||
| List<BibEntry> selectedEntries, | ||
| Selection includeSelectedEntries | ||
| ) { | ||
| this.dialogService = dialogService; | ||
| this.preferencesService = preferencesService; | ||
| this.currentDatabase = currentDatabase; | ||
| this.editedGroup = editedGroup; | ||
| this.parentNode = parentNode; | ||
| this.fileUpdateMonitor = fileUpdateMonitor; | ||
| this.selectedEntries = selectedEntries; | ||
| this.includeSelectedEntries = includeSelectedEntries; | ||
| | ||
| setupValidation(); | ||
| setValues(); | ||
| } | ||
| | ||
| public GroupDialogViewModel( | ||
| DialogService dialogService, | ||
| BibDatabaseContext currentDatabase, | ||
| PreferencesService preferencesService, | ||
| @Nullable AbstractGroup editedGroup, | ||
| @Nullable GroupTreeNode parentNode, | ||
| FileUpdateMonitor fileUpdateMonitor | ||
| ) { | ||
| this(dialogService, currentDatabase, preferencesService, editedGroup, parentNode, fileUpdateMonitor, new ArrayList<>(), Selection.IGNORE_SELECTED_ENTRIES); | ||
| Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. USe | ||
| } | ||
| | ||
| private void setupValidation() { | ||
| validator = new CompositeValidator(); | ||
| | ||
| | @@ -246,7 +269,7 @@ private void setupValidation() { | |
| return false; | ||
| } | ||
| return FileUtil.getFileExtension(input) | ||
| .map(extension -> "aux".equalsIgnoreCase(extension)) | ||
| .map("aux"::equalsIgnoreCase) | ||
| .orElse(false); | ||
| } | ||
| }, | ||
| | @@ -310,10 +333,15 @@ public AbstractGroup resultConverter(ButtonType button) { | |
| try { | ||
| String groupName = nameProperty.getValue().trim(); | ||
| if (typeExplicitProperty.getValue()) { | ||
| resultingGroup = new ExplicitGroup( | ||
| ExplicitGroup tempResultingGroup = new ExplicitGroup( | ||
| ||
| groupName, | ||
| groupHierarchySelectedProperty.getValue(), | ||
| preferencesService.getBibEntryPreferences().getKeywordSeparator()); | ||
| preferencesService.getBibEntryPreferences().getKeywordSeparator() | ||
| ); | ||
| if (explicitIncludeSelectedProperty.getValue()) { | ||
| tempResultingGroup.add(selectedEntries); | ||
| } | ||
| resultingGroup = tempResultingGroup; | ||
| } else if (typeKeywordsProperty.getValue()) { | ||
| if (keywordGroupRegexProperty.getValue()) { | ||
| resultingGroup = new RegexKeywordGroup( | ||
| | @@ -372,7 +400,6 @@ public AbstractGroup resultConverter(ButtonType button) { | |
| fileUpdateMonitor, | ||
| currentDatabase.getMetaData()); | ||
| } | ||
| | ||
| if (resultingGroup != null) { | ||
| preferencesService.getGroupsPreferences().setDefaultHierarchicalContext(groupHierarchySelectedProperty.getValue()); | ||
| | ||
| | @@ -391,7 +418,7 @@ public AbstractGroup resultConverter(ButtonType button) { | |
| | ||
| public void setValues() { | ||
| groupHierarchyListProperty.setValue(FXCollections.observableArrayList(GroupHierarchyType.values())); | ||
| | ||
| explicitIncludeSelectedProperty.setValue(includeSelectedEntries == Selection.INCLUDE_SELECTED_ENTRIES || preferencesService.getGroupsPreferences().shouldAutoIncludeSelected()); | ||
| if (editedGroup == null) { | ||
| // creating new group -> defaults! | ||
| // TODO: Create default group (via org.jabref.logic.groups.DefaultGroupsFactory) and use values | ||
| | @@ -492,7 +519,7 @@ public void texGroupBrowse() { | |
| } | ||
| | ||
| private List<Path> getFileDirectoriesAsPaths() { | ||
| List<Path> fileDirs = new ArrayList<>(); | ||
| List<Path> fileDirs = List.of(); | ||
| MetaData metaData = currentDatabase.getMetaData(); | ||
| metaData.getLatexFileDirectory(preferencesService.getFilePreferences().getUserAndHost()).ifPresent(fileDirs::add); | ||
| | ||
| | @@ -535,7 +562,7 @@ public ValidationStatus keywordSearchTermEmptyValidationStatus() { | |
| return keywordSearchTermEmptyValidator.getValidationStatus(); | ||
| } | ||
| | ||
| public ValidationStatus texGroupFilePathValidatonStatus() { | ||
| public ValidationStatus texGroupFilePathValidationStatus() { | ||
| return texGroupFilePathValidator.getValidationStatus(); | ||
| } | ||
| | ||
| | @@ -587,6 +614,10 @@ public BooleanProperty typeTexProperty() { | |
| return typeTexProperty; | ||
| } | ||
| | ||
| public BooleanProperty explicitIncludeSelectedProperty() { | ||
| return explicitIncludeSelectedProperty; | ||
| } | ||
| | ||
| public StringProperty keywordGroupSearchTermProperty() { | ||
| return keywordGroupSearchTermProperty; | ||
| } | ||
| | ||


Uh oh!
There was an error while loading. Please reload this page.