From f90afdd7d557a5a5081f1d95a65748e16acded9c Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 15 Feb 2017 22:37:58 +0100 Subject: [PATCH 1/5] Add automatic groups --- .../jabref/gui/groups/GroupNodeViewModel.java | 34 +++++++++++++- .../sf/jabref/logic/util/OptionalUtil.java | 21 +++++++++ .../sf/jabref/model/database/BibDatabase.java | 9 ++-- .../jabref/model/groups/AutomaticGroup.java | 45 +++++++++++++++++++ .../model/groups/AutomaticGroupTest.java | 25 +++++++++++ 5 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java create mode 100644 src/test/java/net/sf/jabref/model/groups/AutomaticGroupTest.java diff --git a/src/main/java/net/sf/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/net/sf/jabref/gui/groups/GroupNodeViewModel.java index 06cd2547f31..80884ab33f5 100644 --- a/src/main/java/net/sf/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/net/sf/jabref/gui/groups/GroupNodeViewModel.java @@ -1,21 +1,30 @@ package net.sf.jabref.gui.groups; +import java.util.Map; import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanBinding; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleIntegerProperty; +import javafx.collections.FXCollections; import javafx.collections.ObservableList; import net.sf.jabref.gui.StateManager; import net.sf.jabref.gui.util.BindingsHelper; import net.sf.jabref.logic.l10n.Localization; import net.sf.jabref.model.database.BibDatabaseContext; +import net.sf.jabref.model.entry.BibEntry; import net.sf.jabref.model.entry.event.EntryEvent; import net.sf.jabref.model.groups.AbstractGroup; import net.sf.jabref.model.groups.AllEntriesGroup; +import net.sf.jabref.model.groups.AutomaticGroup; import net.sf.jabref.model.groups.GroupTreeNode; import com.google.common.eventbus.Subscribe; @@ -41,7 +50,20 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state name = groupNode.getName(); isRoot = groupNode.isRoot(); iconCode = ""; - children = EasyBind.map(groupNode.getChildren(), child -> new GroupNodeViewModel(databaseContext, stateManager, child)); + if (groupNode.getGroup().getClass() == AutomaticGroup.class) { + AutomaticGroup automaticGroup = (AutomaticGroup) groupNode.getGroup(); + + // TODO: Update on changes to entry list (however: there is no flatMap and filter as observable TransformationLists) + children = databaseContext.getDatabase() + .getEntries().stream() + .flatMap(stream -> createSubgroups(databaseContext, stateManager, automaticGroup, stream)) + .filter(distinctByKey(GroupNodeViewModel::getName)) + .sorted((group1, group2) -> group1.getName().compareToIgnoreCase(group2.getName())) + .collect(Collectors.toCollection(FXCollections::observableArrayList)); + } else { + children = EasyBind.map(groupNode.getChildren(), + child -> new GroupNodeViewModel(databaseContext, stateManager, child)); + } hasChildren = new SimpleBooleanProperty(); hasChildren.bind(Bindings.isNotEmpty(children)); hits = new SimpleIntegerProperty(0); @@ -55,6 +77,16 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state allSelectedEntriesMatched = BindingsHelper.all(selectedEntriesMatchStatus, matched -> matched); } + private static Predicate distinctByKey(Function keyExtractor) { + Map seen = new ConcurrentHashMap<>(); + return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; + } + + private Stream createSubgroups(BibDatabaseContext databaseContext, StateManager stateManager, AutomaticGroup automaticGroup, BibEntry entry) { + return automaticGroup.createSubgroups(entry).stream() + .map(child -> new GroupNodeViewModel(databaseContext, stateManager, child)); + } + public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, AbstractGroup group) { this(databaseContext, stateManager, new GroupTreeNode(group)); } diff --git a/src/main/java/net/sf/jabref/logic/util/OptionalUtil.java b/src/main/java/net/sf/jabref/logic/util/OptionalUtil.java index 826ac86c1cb..d1bbccb43ec 100644 --- a/src/main/java/net/sf/jabref/logic/util/OptionalUtil.java +++ b/src/main/java/net/sf/jabref/logic/util/OptionalUtil.java @@ -1,8 +1,10 @@ package net.sf.jabref.logic.util; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Optional; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -16,8 +18,27 @@ public static List toList(Optional value) { } } + /** + * No longer needed in Java 9 where {@code Optional.stream()} is added. + */ + public static Stream toStream(Optional value) { + if (value.isPresent()) { + return Stream.of(value.get()); + } else { + return Stream.empty(); + } + } + @SafeVarargs public static List toList(Optional... values) { return Stream.of(values).flatMap(optional -> toList(optional).stream()).collect(Collectors.toList()); } + + public static Stream flatMapFromStream(Optional value, Function> mapper) { + return toStream(value).flatMap(mapper); + } + + public static Stream flatMap(Optional value, Function> mapper) { + return toStream(value).flatMap(element -> mapper.apply(element).stream()); + } } diff --git a/src/main/java/net/sf/jabref/model/database/BibDatabase.java b/src/main/java/net/sf/jabref/model/database/BibDatabase.java index fdd4e1e3cda..546b74e334f 100644 --- a/src/main/java/net/sf/jabref/model/database/BibDatabase.java +++ b/src/main/java/net/sf/jabref/model/database/BibDatabase.java @@ -17,6 +17,9 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; + import net.sf.jabref.model.database.event.EntryAddedEvent; import net.sf.jabref.model.database.event.EntryRemovedEvent; import net.sf.jabref.model.entry.BibEntry; @@ -43,7 +46,7 @@ public class BibDatabase { /** * State attributes */ - private final List entries = Collections.synchronizedList(new ArrayList<>()); + private final ObservableList entries = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); private String preamble; // All file contents below the last entry in the file @@ -99,8 +102,8 @@ public boolean containsEntryWithId(String id) { return internalIDs.contains(id); } - public List getEntries() { - return Collections.unmodifiableList(entries); + public ObservableList getEntries() { + return FXCollections.unmodifiableObservableList(entries); } /** diff --git a/src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java b/src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java new file mode 100644 index 00000000000..010b106a57c --- /dev/null +++ b/src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java @@ -0,0 +1,45 @@ +package net.sf.jabref.model.groups; + +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import net.sf.jabref.logic.util.OptionalUtil; +import net.sf.jabref.model.entry.BibEntry; +import net.sf.jabref.model.entry.KeywordList; + +public class AutomaticGroup extends AbstractGroup { + + public AutomaticGroup(String name, GroupHierarchyType context, String field, Character keywordSeperator) { + super(name, context); + this.field = field; + this.keywordSeperator = keywordSeperator; + } + + private Character keywordSeperator; + private String field; + + @Override + public boolean contains(BibEntry entry) { + return false; + } + + @Override + public boolean isDynamic() { + return false; + } + + @Override + public AbstractGroup deepCopy() { + return new AutomaticGroup(this.name, this.context, field, this.keywordSeperator); + } + + public Set createSubgroups(BibEntry entry) { + Optional keywordList = entry.getLatexFreeField(field) + .map(fieldValue -> KeywordList.parse(fieldValue, keywordSeperator)); + return OptionalUtil.flatMap(keywordList, KeywordList::toStringList) + .map(keyword -> new WordKeywordGroup(keyword, GroupHierarchyType.INDEPENDENT, field, keyword, true, keywordSeperator, true)) + .map(GroupTreeNode::new) + .collect(Collectors.toSet()); + } +} diff --git a/src/test/java/net/sf/jabref/model/groups/AutomaticGroupTest.java b/src/test/java/net/sf/jabref/model/groups/AutomaticGroupTest.java new file mode 100644 index 00000000000..77476748609 --- /dev/null +++ b/src/test/java/net/sf/jabref/model/groups/AutomaticGroupTest.java @@ -0,0 +1,25 @@ +package net.sf.jabref.model.groups; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.sf.jabref.model.entry.BibEntry; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class AutomaticGroupTest { + + @Test + public void createSubgroupsForTwoKeywords() throws Exception { + AutomaticGroup keywordsGroup = new AutomaticGroup("Keywords", GroupHierarchyType.INDEPENDENT, "keywords", ','); + BibEntry entry = new BibEntry().withField("keywords", "A, B"); + + Set expected = new HashSet<>(); + expected.add(GroupTreeNode.fromGroup(new WordKeywordGroup("A", GroupHierarchyType.INDEPENDENT, "keywords", "A", true, ',', true))); + expected.add(GroupTreeNode.fromGroup(new WordKeywordGroup("B", GroupHierarchyType.INDEPENDENT, "keywords", "B", true, ',', true))); + assertEquals(expected, keywordsGroup.createSubgroups(entry)); + } +} From 5b52e62cf15760b645d60dcea1322e22f6cd58ed Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 17 Feb 2017 16:59:55 +0100 Subject: [PATCH 2/5] Add option for automatic groups in group dialog --- .../sf/jabref/gui/groups/AutoGroupDialog.java | 264 ------------------ .../net/sf/jabref/gui/groups/GroupDialog.java | 136 ++++++--- .../jabref/gui/groups/GroupNodeViewModel.java | 40 +-- .../sf/jabref/gui/groups/GroupSelector.java | 11 - .../gui/groups/GroupTreeController.java | 2 +- .../jabref/model/groups/AutomaticGroup.java | 28 +- .../model/groups/AutomaticKeywordGroup.java | 44 +++ .../model/groups/AutomaticPersonsGroup.java | 43 +++ .../gui/groups/GroupNodeViewModelTest.java | 40 +++ .../sf/jabref/gui/groups/GroupsUtilTest.java | 53 ---- ...st.java => AutomaticKeywordGroupTest.java} | 7 +- 11 files changed, 259 insertions(+), 409 deletions(-) delete mode 100644 src/main/java/net/sf/jabref/gui/groups/AutoGroupDialog.java create mode 100644 src/main/java/net/sf/jabref/model/groups/AutomaticKeywordGroup.java create mode 100644 src/main/java/net/sf/jabref/model/groups/AutomaticPersonsGroup.java create mode 100644 src/test/java/net/sf/jabref/gui/groups/GroupNodeViewModelTest.java delete mode 100644 src/test/java/net/sf/jabref/gui/groups/GroupsUtilTest.java rename src/test/java/net/sf/jabref/model/groups/{AutomaticGroupTest.java => AutomaticKeywordGroupTest.java} (76%) diff --git a/src/main/java/net/sf/jabref/gui/groups/AutoGroupDialog.java b/src/main/java/net/sf/jabref/gui/groups/AutoGroupDialog.java deleted file mode 100644 index f3e108f0cec..00000000000 --- a/src/main/java/net/sf/jabref/gui/groups/AutoGroupDialog.java +++ /dev/null @@ -1,264 +0,0 @@ -package net.sf.jabref.gui.groups; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.TreeSet; -import java.util.stream.Collectors; - -import javax.swing.AbstractAction; -import javax.swing.ActionMap; -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.InputMap; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JTextField; -import javax.swing.event.CaretEvent; -import javax.swing.event.CaretListener; - -import net.sf.jabref.Globals; -import net.sf.jabref.gui.BasePanel; -import net.sf.jabref.gui.JabRefFrame; -import net.sf.jabref.gui.keyboard.KeyBinding; -import net.sf.jabref.gui.undo.NamedCompound; -import net.sf.jabref.logic.l10n.Localization; -import net.sf.jabref.logic.layout.format.LatexToUnicodeFormatter; -import net.sf.jabref.model.database.BibDatabase; -import net.sf.jabref.model.entry.Author; -import net.sf.jabref.model.entry.AuthorList; -import net.sf.jabref.model.entry.BibEntry; -import net.sf.jabref.model.entry.FieldName; -import net.sf.jabref.model.groups.ExplicitGroup; -import net.sf.jabref.model.groups.GroupHierarchyType; -import net.sf.jabref.model.groups.GroupTreeNode; -import net.sf.jabref.model.groups.WordKeywordGroup; -import net.sf.jabref.model.strings.StringUtil; - -import com.jgoodies.forms.builder.ButtonBarBuilder; -import com.jgoodies.forms.builder.FormBuilder; -import com.jgoodies.forms.layout.FormLayout; - -/** - * Dialog for creating or modifying groups. Operates directly on the Vector containing group information. - */ -class AutoGroupDialog extends JDialog implements CaretListener { - - private final JTextField remove = new JTextField(60); - private final JTextField field = new JTextField(60); - private final JTextField deliminator = new JTextField(60); - private final JRadioButton keywords = new JRadioButton( - Localization.lang("Generate groups from keywords in a BibTeX field")); - private final JRadioButton authors = new JRadioButton(Localization.lang("Generate groups for author last names")); - private final JRadioButton editors = new JRadioButton(Localization.lang("Generate groups for editor last names")); - private final JCheckBox useCustomDelimiter = new JCheckBox( - Localization.lang("Use the following delimiter character(s):")); - private final JButton ok = new JButton(Localization.lang("OK")); - private final GroupTreeNodeViewModel m_groupsRoot; - private final JabRefFrame frame; - private final BasePanel panel; - - - /** - * @param groupsRoot The original set of groups, which is required as undo information when all groups are cleared. - */ - public AutoGroupDialog(JabRefFrame jabrefFrame, BasePanel basePanel, - GroupTreeNodeViewModel groupsRoot, String defaultField, String defaultRemove, String defaultDeliminator) { - super(jabrefFrame, Localization.lang("Automatically create groups"), true); - frame = jabrefFrame; - panel = basePanel; - m_groupsRoot = groupsRoot; - field.setText(defaultField); - remove.setText(defaultRemove); - deliminator.setText(defaultDeliminator); - useCustomDelimiter.setSelected(true); - ActionListener okListener = e -> { - dispose(); - - try { - GroupTreeNode autoGroupsRoot = GroupTreeNode.fromGroup( - new ExplicitGroup(Localization.lang("Automatically created groups"), - GroupHierarchyType.INCLUDING, - Globals.prefs.getKeywordDelimiter())); - Set keywords; - String fieldText = field.getText().toLowerCase().trim(); - if (this.keywords.isSelected()) { - if (useCustomDelimiter.isSelected()) { - keywords = findDeliminatedWordsInField(panel.getDatabase(), fieldText, - deliminator.getText()); - } else { - keywords = findAllWordsInField(panel.getDatabase(), fieldText, remove.getText()); - - } - } else if (authors.isSelected()) { - List fields = new ArrayList<>(2); - fields.add(FieldName.AUTHOR); - keywords = findAuthorLastNames(panel.getDatabase(), fields); - fieldText = FieldName.AUTHOR; - } else { // editors.isSelected() as it is a radio button group. - List fields = new ArrayList<>(2); - fields.add(FieldName.EDITOR); - keywords = findAuthorLastNames(panel.getDatabase(), fields); - fieldText = FieldName.EDITOR; - } - - LatexToUnicodeFormatter formatter = new LatexToUnicodeFormatter(); - - for (String keyword : keywords) { - WordKeywordGroup group = new WordKeywordGroup( - formatter.format(keyword), GroupHierarchyType.INDEPENDENT, fieldText, keyword, false, Globals.prefs.getKeywordDelimiter(), false); - autoGroupsRoot.addChild(GroupTreeNode.fromGroup(group)); - } - - autoGroupsRoot.moveTo(m_groupsRoot.getNode()); - NamedCompound ce = new NamedCompound(Localization.lang("Automatically create groups")); - UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(m_groupsRoot, new GroupTreeNodeViewModel(autoGroupsRoot), UndoableAddOrRemoveGroup.ADD_NODE); - ce.addEdit(undo); - - panel.markBaseChanged(); // a change always occurs - frame.output(Localization.lang("Created groups.")); - ce.end(); - panel.getUndoManager().addEdit(ce); - } catch (IllegalArgumentException exception) { - frame.showMessage(exception.getLocalizedMessage()); - } - }; - remove.addActionListener(okListener); - field.addActionListener(okListener); - field.addCaretListener(this); - AbstractAction cancelAction = new AbstractAction() { - - @Override - public void actionPerformed(ActionEvent e) { - dispose(); - } - }; - JButton cancel = new JButton(Localization.lang("Cancel")); - cancel.addActionListener(cancelAction); - ok.addActionListener(okListener); - // Key bindings: - JPanel main = new JPanel(); - ActionMap am = main.getActionMap(); - InputMap im = main.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); - im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close"); - am.put("close", cancelAction); - - ButtonGroup bg = new ButtonGroup(); - bg.add(keywords); - bg.add(authors); - bg.add(editors); - keywords.setSelected(true); - - FormBuilder b = FormBuilder.create(); - b.layout(new FormLayout("left:20dlu, 4dlu, left:pref, 4dlu, fill:60dlu", - "p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p")); - b.add(keywords).xyw(1, 1, 5); - b.add(Localization.lang("Field to group by") + ":").xy(3, 3); - b.add(field).xy(5, 3); - b.add(Localization.lang("Characters to ignore") + ":").xy(3, 5); - b.add(remove).xy(5, 5); - b.add(useCustomDelimiter).xy(3, 7); - b.add(deliminator).xy(5, 7); - b.add(authors).xyw(1, 9, 5); - b.add(editors).xyw(1, 11, 5); - b.build(); - b.border(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - - JPanel opt = new JPanel(); - ButtonBarBuilder bb = new ButtonBarBuilder(opt); - bb.addGlue(); - bb.addButton(ok); - bb.addButton(cancel); - bb.addGlue(); - - main.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - opt.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - getContentPane().add(main, BorderLayout.CENTER); - getContentPane().add(b.getPanel(), BorderLayout.CENTER); - getContentPane().add(opt, BorderLayout.SOUTH); - - updateComponents(); - pack(); - setLocationRelativeTo(frame); - } - - public static Set findDeliminatedWordsInField(BibDatabase db, String field, String deliminator) { - Set res = new TreeSet<>(); - - for (BibEntry be : db.getEntries()) { - be.getField(field).ifPresent(fieldValue -> { - StringTokenizer tok = new StringTokenizer(fieldValue.trim(), deliminator); - while (tok.hasMoreTokens()) { - res.add(StringUtil.capitalizeFirst(tok.nextToken().trim())); - } - }); - } - return res; - } - - /** - * Returns a Set containing all words used in the database in the given field type. Characters in - * remove are not included. - * - * @param db a BibDatabase value - * @param field a String value - * @param remove a String value - * @return a Set value - */ - public static Set findAllWordsInField(BibDatabase db, String field, String remove) { - Set res = new TreeSet<>(); - for (BibEntry be : db.getEntries()) { - be.getField(field).ifPresent(o -> { - StringTokenizer tok = new StringTokenizer(o, remove, false); - while (tok.hasMoreTokens()) { - res.add(StringUtil.capitalizeFirst(tok.nextToken().trim())); - } - }); - } - return res; - } - - /** - * Finds all authors' last names in all the given fields for the given database. - * - * @param db The database. - * @param fields The fields to look in. - * @return a set containing the names. - */ - public static Set findAuthorLastNames(BibDatabase db, List fields) { - Set res = new TreeSet<>(); - for (BibEntry be : db.getEntries()) { - for (String field : fields) { - be.getField(field).ifPresent(val -> { - if (!val.isEmpty()) { - AuthorList al = AuthorList.parse(val); - res.addAll(al.getAuthors().stream().map(Author::getLast).filter(Optional::isPresent) - .map(Optional::get).filter(lastName -> !lastName.isEmpty()) - .collect(Collectors.toList())); - } - }); - } - } - - return res; - } - - @Override - public void caretUpdate(CaretEvent e) { - updateComponents(); - } - - private void updateComponents() { - String groupField = field.getText().trim(); - ok.setEnabled(groupField.matches("\\w+")); - } -} diff --git a/src/main/java/net/sf/jabref/gui/groups/GroupDialog.java b/src/main/java/net/sf/jabref/gui/groups/GroupDialog.java index a5ca9be3d75..ca0f8888571 100644 --- a/src/main/java/net/sf/jabref/gui/groups/GroupDialog.java +++ b/src/main/java/net/sf/jabref/gui/groups/GroupDialog.java @@ -38,6 +38,8 @@ import net.sf.jabref.logic.search.SearchQuery; import net.sf.jabref.model.entry.FieldName; import net.sf.jabref.model.groups.AbstractGroup; +import net.sf.jabref.model.groups.AutomaticKeywordGroup; +import net.sf.jabref.model.groups.AutomaticPersonsGroup; import net.sf.jabref.model.groups.ExplicitGroup; import net.sf.jabref.model.groups.GroupHierarchyType; import net.sf.jabref.model.groups.RegexKeywordGroup; @@ -48,6 +50,7 @@ import com.jgoodies.forms.builder.ButtonBarBuilder; import com.jgoodies.forms.builder.DefaultFormBuilder; +import com.jgoodies.forms.builder.FormBuilder; import com.jgoodies.forms.layout.FormLayout; /** @@ -59,6 +62,7 @@ class GroupDialog extends JDialog implements Dialog { private static final int INDEX_EXPLICIT_GROUP = 0; private static final int INDEX_KEYWORD_GROUP = 1; private static final int INDEX_SEARCH_GROUP = 2; + private static final int INDEX_AUTO_GROUP = 3; private static final int TEXTFIELD_LENGTH = 30; // for all types private final JTextField nameField = new JTextField(GroupDialog.TEXTFIELD_LENGTH); @@ -68,6 +72,8 @@ class GroupDialog extends JDialog implements Dialog { Localization.lang("Dynamically group entries by searching a field for a keyword")); private final JRadioButton searchRadioButton = new JRadioButton( Localization.lang("Dynamically group entries by a free-form search expression")); + private final JRadioButton autoRadioButton = new JRadioButton( + Localization.lang("Automatically create groups")); private final JRadioButton independentButton = new JRadioButton( Localization.lang("Independent group: When selected, view only this group's entries")); private final JRadioButton intersectionButton = new JRadioButton( @@ -83,6 +89,15 @@ class GroupDialog extends JDialog implements Dialog { private final JTextField searchGroupSearchExpression = new JTextField(GroupDialog.TEXTFIELD_LENGTH); private final JCheckBox searchGroupCaseSensitive = new JCheckBox(Localization.lang("Case sensitive")); private final JCheckBox searchGroupRegExp = new JCheckBox(Localization.lang("regular expression")); + // for AutoGroup + private final JRadioButton autoGroupKeywordsOption = new JRadioButton( + Localization.lang("Generate groups from keywords in a BibTeX field")); + private final JTextField autoGroupKeywordsField = new JTextField(60); + private final JTextField autoGroupKeywordsDeliminator = new JTextField(60); + private final JRadioButton autoGroupPersonsOption = new JRadioButton( + Localization.lang("Generate groups for author last names")); + private final JTextField autoGroupPersonsField = new JTextField(60); + // for all types private final JButton okButton = new JButton(Localization.lang("OK")); private final JPanel optionsPanel = new JPanel(); @@ -119,6 +134,7 @@ public GroupDialog(JabRefFrame jabrefFrame, AbstractGroup editedGroup) { groupType.add(explicitRadioButton); groupType.add(keywordsRadioButton); groupType.add(searchRadioButton); + groupType.add(autoRadioButton); ButtonGroup groupHierarchy = new ButtonGroup(); groupHierarchy.add(independentButton); groupHierarchy.add(intersectionButton); @@ -154,6 +170,31 @@ public GroupDialog(JabRefFrame jabrefFrame, AbstractGroup editedGroup) { builderSG.nextLine(); builderSG.append(searchGroupRegExp, 3); optionsPanel.add(builderSG.getPanel(), String.valueOf(GroupDialog.INDEX_SEARCH_GROUP)); + + // for auto group + ButtonGroup bg = new ButtonGroup(); + bg.add(autoGroupKeywordsOption); + bg.add(autoGroupPersonsOption); + + FormLayout layoutAutoGroup = new FormLayout("left:20dlu, 4dlu, left:pref, 4dlu, fill:60dlu", + "p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p"); + FormBuilder builderAutoGroup = FormBuilder.create(); + builderAutoGroup.layout(layoutAutoGroup); + builderAutoGroup.add(autoGroupKeywordsOption).xyw(1, 1, 5); + builderAutoGroup.add(Localization.lang("Field to group by") + ":").xy(3, 3); + builderAutoGroup.add(autoGroupKeywordsField).xy(5, 3); + builderAutoGroup.add(Localization.lang("Use the following delimiter character(s):")).xy(3, 5); + builderAutoGroup.add(autoGroupKeywordsDeliminator).xy(5, 5); + builderAutoGroup.add(autoGroupPersonsOption).xyw(1, 7, 5); + builderAutoGroup.add(Localization.lang("Field to group by") + ":").xy(3, 9); + builderAutoGroup.add(autoGroupPersonsField).xy(5, 9); + optionsPanel.add(builderAutoGroup.build(), String.valueOf(GroupDialog.INDEX_AUTO_GROUP)); + + autoGroupKeywordsOption.setSelected(true); + autoGroupKeywordsField.setText(Globals.prefs.get(JabRefPreferences.GROUPS_DEFAULT_FIELD)); + autoGroupKeywordsDeliminator.setText(Globals.prefs.get(JabRefPreferences.KEYWORD_SEPARATOR)); + autoGroupPersonsField.setText(FieldName.AUTHOR); + // ... for buttons panel FormLayout layoutBP = new FormLayout("pref, 4dlu, pref", "p"); layoutBP.setColumnGroups(new int[][] {{1, 3}}); @@ -168,7 +209,7 @@ public GroupDialog(JabRefFrame jabrefFrame, AbstractGroup editedGroup) { // create layout FormLayout layoutAll = new FormLayout( "right:pref, 4dlu, fill:600px, 4dlu, fill:pref", - "p, 3dlu, p, 3dlu, p, 0dlu, p, 0dlu, p, 3dlu, p, 3dlu, p, " + "p, 3dlu, p, 3dlu, p, 0dlu, p, 0dlu, p, 0dlu, p, 3dlu, p, 3dlu, p, " + "0dlu, p, 0dlu, p, 3dlu, p, 3dlu, " + "p, 3dlu, p, 3dlu, top:80dlu, 9dlu, p, 9dlu, p"); @@ -189,6 +230,9 @@ public GroupDialog(JabRefFrame jabrefFrame, AbstractGroup editedGroup) { builderAll.append(searchRadioButton, 5); builderAll.nextLine(); builderAll.nextLine(); + builderAll.append(autoRadioButton, 5); + builderAll.nextLine(); + builderAll.nextLine(); builderAll.appendSeparator(Localization.lang("Hierarchical context")); builderAll.nextLine(); builderAll.nextLine(); @@ -243,6 +287,7 @@ public Dimension getPreferredSize() { explicitRadioButton.addItemListener(radioButtonItemListener); keywordsRadioButton.addItemListener(radioButtonItemListener); searchRadioButton.addItemListener(radioButtonItemListener); + autoRadioButton.addItemListener(radioButtonItemListener); Action cancelAction = new AbstractAction() { @@ -284,6 +329,15 @@ public void actionPerformed(ActionEvent e) { } catch (Exception e1) { // should never happen } + } else if (autoRadioButton.isSelected()) { + if (autoGroupKeywordsOption.isSelected()) { + resultingGroup = new AutomaticKeywordGroup(nameField.getText().trim(), getContext(), + autoGroupKeywordsField.getText().trim(), + autoGroupKeywordsDeliminator.getText().charAt(0)); + } else { + resultingGroup = new AutomaticPersonsGroup(nameField.getText().trim(), getContext(), + autoGroupPersonsField.getText().trim()); + } } dispose(); } catch (IllegalArgumentException exception) { @@ -304,39 +358,55 @@ public void actionPerformed(ActionEvent e) { searchGroupCaseSensitive.addItemListener(itemListener); // configure for current type - if ((editedGroup != null) && (editedGroup.getClass() == WordKeywordGroup.class)) { - WordKeywordGroup group = (WordKeywordGroup) editedGroup; - nameField.setText(group.getName()); - keywordGroupSearchField.setText(group.getSearchField()); - keywordGroupSearchTerm.setText(group.getSearchExpression()); - keywordGroupCaseSensitive.setSelected(group.isCaseSensitive()); - keywordGroupRegExp.setSelected(false); - keywordsRadioButton.setSelected(true); - setContext(editedGroup.getHierarchicalContext()); - } else if ((editedGroup != null) && (editedGroup.getClass() == RegexKeywordGroup.class)) { - RegexKeywordGroup group = (RegexKeywordGroup) editedGroup; - nameField.setText(group.getName()); - keywordGroupSearchField.setText(group.getSearchField()); - keywordGroupSearchTerm.setText(group.getSearchExpression()); - keywordGroupCaseSensitive.setSelected(group.isCaseSensitive()); - keywordGroupRegExp.setSelected(true); - keywordsRadioButton.setSelected(true); - setContext(editedGroup.getHierarchicalContext()); - } else if ((editedGroup != null) && (editedGroup.getClass() == SearchGroup.class)) { - SearchGroup group = (SearchGroup) editedGroup; - nameField.setText(group.getName()); - searchGroupSearchExpression.setText(group.getSearchExpression()); - searchGroupCaseSensitive.setSelected(group.isCaseSensitive()); - searchGroupRegExp.setSelected(group.isRegularExpression()); - searchRadioButton.setSelected(true); - setContext(editedGroup.getHierarchicalContext()); - } else if ((editedGroup != null) && (editedGroup.getClass() == ExplicitGroup.class)) { - nameField.setText(editedGroup.getName()); - explicitRadioButton.setSelected(true); - setContext(editedGroup.getHierarchicalContext()); - } else { // creating new group -> defaults! + if (editedGroup == null) { + // creating new group -> defaults! explicitRadioButton.setSelected(true); setContext(GroupHierarchyType.INDEPENDENT); + } else { + if (editedGroup.getClass() == WordKeywordGroup.class) { + WordKeywordGroup group = (WordKeywordGroup) editedGroup; + nameField.setText(group.getName()); + keywordGroupSearchField.setText(group.getSearchField()); + keywordGroupSearchTerm.setText(group.getSearchExpression()); + keywordGroupCaseSensitive.setSelected(group.isCaseSensitive()); + keywordGroupRegExp.setSelected(false); + keywordsRadioButton.setSelected(true); + setContext(editedGroup.getHierarchicalContext()); + } else if (editedGroup.getClass() == RegexKeywordGroup.class) { + RegexKeywordGroup group = (RegexKeywordGroup) editedGroup; + nameField.setText(group.getName()); + keywordGroupSearchField.setText(group.getSearchField()); + keywordGroupSearchTerm.setText(group.getSearchExpression()); + keywordGroupCaseSensitive.setSelected(group.isCaseSensitive()); + keywordGroupRegExp.setSelected(true); + keywordsRadioButton.setSelected(true); + setContext(editedGroup.getHierarchicalContext()); + } else if (editedGroup.getClass() == SearchGroup.class) { + SearchGroup group = (SearchGroup) editedGroup; + nameField.setText(group.getName()); + searchGroupSearchExpression.setText(group.getSearchExpression()); + searchGroupCaseSensitive.setSelected(group.isCaseSensitive()); + searchGroupRegExp.setSelected(group.isRegularExpression()); + searchRadioButton.setSelected(true); + setContext(editedGroup.getHierarchicalContext()); + } else if (editedGroup.getClass() == ExplicitGroup.class) { + nameField.setText(editedGroup.getName()); + explicitRadioButton.setSelected(true); + setContext(editedGroup.getHierarchicalContext()); + } else if (editedGroup.getClass() == AutomaticKeywordGroup.class) { + nameField.setText(editedGroup.getName()); + autoRadioButton.setSelected(true); + setContext(editedGroup.getHierarchicalContext()); + + if (editedGroup.getClass() == AutomaticKeywordGroup.class) { + AutomaticKeywordGroup group = (AutomaticKeywordGroup) editedGroup; + autoGroupKeywordsDeliminator.setText(group.getKeywordSeperator().toString()); + autoGroupKeywordsField.setText(group.getField()); + } else if (editedGroup.getClass() == AutomaticPersonsGroup.class) { + AutomaticPersonsGroup group = (AutomaticPersonsGroup) editedGroup; + autoGroupPersonsField.setText(group.getField()); + } + } } } @@ -385,6 +455,8 @@ private void setLayoutForSelectedGroup() { optionsLayout.show(optionsPanel, String.valueOf(GroupDialog.INDEX_KEYWORD_GROUP)); } else if (searchRadioButton.isSelected()) { optionsLayout.show(optionsPanel, String.valueOf(GroupDialog.INDEX_SEARCH_GROUP)); + } else if (autoRadioButton.isSelected()) { + optionsLayout.show(optionsPanel, String.valueOf(GroupDialog.INDEX_AUTO_GROUP)); } } diff --git a/src/main/java/net/sf/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/net/sf/jabref/gui/groups/GroupNodeViewModel.java index 80884ab33f5..7a4415bb0d4 100644 --- a/src/main/java/net/sf/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/net/sf/jabref/gui/groups/GroupNodeViewModel.java @@ -19,6 +19,7 @@ import net.sf.jabref.gui.StateManager; import net.sf.jabref.gui.util.BindingsHelper; import net.sf.jabref.logic.l10n.Localization; +import net.sf.jabref.logic.layout.format.LatexToUnicodeFormatter; import net.sf.jabref.model.database.BibDatabaseContext; import net.sf.jabref.model.entry.BibEntry; import net.sf.jabref.model.entry.event.EntryEvent; @@ -32,7 +33,7 @@ public class GroupNodeViewModel { - private final String name; + private final String displayName; private final boolean isRoot; private final String iconCode; private final ObservableList children; @@ -47,18 +48,19 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state this.databaseContext = Objects.requireNonNull(databaseContext); this.groupNode = Objects.requireNonNull(groupNode); - name = groupNode.getName(); + LatexToUnicodeFormatter formatter = new LatexToUnicodeFormatter(); + displayName = formatter.format(groupNode.getName()); isRoot = groupNode.isRoot(); iconCode = ""; - if (groupNode.getGroup().getClass() == AutomaticGroup.class) { + if (groupNode.getGroup() instanceof AutomaticGroup) { AutomaticGroup automaticGroup = (AutomaticGroup) groupNode.getGroup(); // TODO: Update on changes to entry list (however: there is no flatMap and filter as observable TransformationLists) children = databaseContext.getDatabase() .getEntries().stream() .flatMap(stream -> createSubgroups(databaseContext, stateManager, automaticGroup, stream)) - .filter(distinctByKey(GroupNodeViewModel::getName)) - .sorted((group1, group2) -> group1.getName().compareToIgnoreCase(group2.getName())) + .filter(distinctByKey(group -> group.getGroupNode().getName())) + .sorted((group1, group2) -> group1.getDisplayName().compareToIgnoreCase(group2.getDisplayName())) .collect(Collectors.toCollection(FXCollections::observableArrayList)); } else { children = EasyBind.map(groupNode.getChildren(), @@ -77,24 +79,24 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state allSelectedEntriesMatched = BindingsHelper.all(selectedEntriesMatchStatus, matched -> matched); } + public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, AbstractGroup group) { + this(databaseContext, stateManager, new GroupTreeNode(group)); + } + private static Predicate distinctByKey(Function keyExtractor) { Map seen = new ConcurrentHashMap<>(); return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; } + static GroupNodeViewModel getAllEntriesGroup(BibDatabaseContext newDatabase, StateManager stateManager) { + return new GroupNodeViewModel(newDatabase, stateManager, new AllEntriesGroup(Localization.lang("All entries"))); + } + private Stream createSubgroups(BibDatabaseContext databaseContext, StateManager stateManager, AutomaticGroup automaticGroup, BibEntry entry) { return automaticGroup.createSubgroups(entry).stream() .map(child -> new GroupNodeViewModel(databaseContext, stateManager, child)); } - public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, AbstractGroup group) { - this(databaseContext, stateManager, new GroupTreeNode(group)); - } - - static GroupNodeViewModel getAllEntriesGroup(BibDatabaseContext newDatabase, StateManager stateManager) { - return new GroupNodeViewModel(newDatabase, stateManager, new AllEntriesGroup(Localization.lang("All entries"))); - } - public BooleanBinding anySelectedEntriesMatchedProperty() { return anySelectedEntriesMatched; } @@ -107,8 +109,8 @@ public SimpleBooleanProperty hasChildrenProperty() { return hasChildren; } - public String getName() { - return name; + public String getDisplayName() { + return displayName; } public boolean isRoot() { @@ -116,7 +118,7 @@ public boolean isRoot() { } public String getDescription() { - return "Some group named " + getName(); + return "Some group named " + getDisplayName(); } public SimpleIntegerProperty getHits() { @@ -131,7 +133,7 @@ public boolean equals(Object o) { GroupNodeViewModel that = (GroupNodeViewModel) o; if (isRoot != that.isRoot) return false; - if (!name.equals(that.name)) return false; + if (!displayName.equals(that.displayName)) return false; if (!iconCode.equals(that.iconCode)) return false; if (!children.equals(that.children)) return false; if (!databaseContext.equals(that.databaseContext)) return false; @@ -142,7 +144,7 @@ public boolean equals(Object o) { @Override public String toString() { return "GroupNodeViewModel{" + - "name='" + name + '\'' + + "displayName='" + displayName + '\'' + ", isRoot=" + isRoot + ", iconCode='" + iconCode + '\'' + ", children=" + children + @@ -154,7 +156,7 @@ public String toString() { @Override public int hashCode() { - int result = name.hashCode(); + int result = displayName.hashCode(); result = 31 * result + (isRoot ? 1 : 0); result = 31 * result + iconCode.hashCode(); result = 31 * result + children.hashCode(); diff --git a/src/main/java/net/sf/jabref/gui/groups/GroupSelector.java b/src/main/java/net/sf/jabref/gui/groups/GroupSelector.java index bbf0a56771e..f58f8ca045f 100644 --- a/src/main/java/net/sf/jabref/gui/groups/GroupSelector.java +++ b/src/main/java/net/sf/jabref/gui/groups/GroupSelector.java @@ -219,7 +219,6 @@ public void stateChanged(ChangeEvent event) { JButton helpButton = new HelpAction(Localization.lang("Help on groups"), HelpFile.GROUP) .getHelpButton(); - JButton autoGroup = new JButton(IconTheme.JabRefIcon.AUTO_GROUP.getSmallIcon()); Insets butIns = new Insets(0, 0, 0, 0); helpButton.setMargin(butIns); openSettings.setMargin(butIns); @@ -227,20 +226,12 @@ public void stateChanged(ChangeEvent event) { orCb.addActionListener(e -> valueChanged(null)); invCb.addActionListener(e -> valueChanged(null)); showOverlappingGroups.addActionListener(e -> valueChanged(null)); - autoGroup.addActionListener(e -> { - AutoGroupDialog gd = new AutoGroupDialog(frame, panel, groupsRoot, - Globals.prefs.get(JabRefPreferences.GROUPS_DEFAULT_FIELD), " .,", - Globals.prefs.get(JabRefPreferences.KEYWORD_SEPARATOR)); - gd.setVisible(true); - // gd does the operation itself - }); floatCb.addActionListener(e -> valueChanged(null)); highlCb.addActionListener(e -> valueChanged(null)); hideNonHits.addActionListener(e -> valueChanged(null)); grayOut.addActionListener(e -> valueChanged(null)); andCb.setToolTipText(Localization.lang("Display only entries belonging to all selected groups.")); orCb.setToolTipText(Localization.lang("Display all entries belonging to one or more of the selected groups.")); - autoGroup.setToolTipText(Localization.lang("Automatically create groups for database.")); openSettings.setToolTipText(Localization.lang("Settings")); invCb.setToolTipText("" + Localization.lang("Show entries not in group selection") + ""); showOverlappingGroups.setToolTipText( @@ -268,8 +259,6 @@ public void stateChanged(ChangeEvent event) { con.gridx = 0; con.gridx = 1; - gbl.setConstraints(autoGroup, con); - rootPanel.add(autoGroup); con.gridx = 2; gbl.setConstraints(openSettings, con); diff --git a/src/main/java/net/sf/jabref/gui/groups/GroupTreeController.java b/src/main/java/net/sf/jabref/gui/groups/GroupTreeController.java index bdf68af7418..819dabaa456 100644 --- a/src/main/java/net/sf/jabref/gui/groups/GroupTreeController.java +++ b/src/main/java/net/sf/jabref/gui/groups/GroupTreeController.java @@ -54,7 +54,7 @@ public void initialize() { // Icon and group name mainColumn.setCellValueFactory(cellData -> cellData.getValue().valueProperty()); mainColumn.setCellFactory(new ViewModelTreeTableCellFactory() - .withText(GroupNodeViewModel::getName) + .withText(GroupNodeViewModel::getDisplayName) .withIcon(GroupNodeViewModel::getIconCode) .withTooltip(GroupNodeViewModel::getDescription) ); diff --git a/src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java b/src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java index 010b106a57c..71f647bb010 100644 --- a/src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java +++ b/src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java @@ -1,24 +1,14 @@ package net.sf.jabref.model.groups; -import java.util.Optional; import java.util.Set; -import java.util.stream.Collectors; -import net.sf.jabref.logic.util.OptionalUtil; import net.sf.jabref.model.entry.BibEntry; -import net.sf.jabref.model.entry.KeywordList; -public class AutomaticGroup extends AbstractGroup { - - public AutomaticGroup(String name, GroupHierarchyType context, String field, Character keywordSeperator) { +public abstract class AutomaticGroup extends AbstractGroup { + public AutomaticGroup(String name, GroupHierarchyType context) { super(name, context); - this.field = field; - this.keywordSeperator = keywordSeperator; } - private Character keywordSeperator; - private String field; - @Override public boolean contains(BibEntry entry) { return false; @@ -29,17 +19,5 @@ public boolean isDynamic() { return false; } - @Override - public AbstractGroup deepCopy() { - return new AutomaticGroup(this.name, this.context, field, this.keywordSeperator); - } - - public Set createSubgroups(BibEntry entry) { - Optional keywordList = entry.getLatexFreeField(field) - .map(fieldValue -> KeywordList.parse(fieldValue, keywordSeperator)); - return OptionalUtil.flatMap(keywordList, KeywordList::toStringList) - .map(keyword -> new WordKeywordGroup(keyword, GroupHierarchyType.INDEPENDENT, field, keyword, true, keywordSeperator, true)) - .map(GroupTreeNode::new) - .collect(Collectors.toSet()); - } + public abstract Set createSubgroups(BibEntry entry); } diff --git a/src/main/java/net/sf/jabref/model/groups/AutomaticKeywordGroup.java b/src/main/java/net/sf/jabref/model/groups/AutomaticKeywordGroup.java new file mode 100644 index 00000000000..f7b7d2ff5c7 --- /dev/null +++ b/src/main/java/net/sf/jabref/model/groups/AutomaticKeywordGroup.java @@ -0,0 +1,44 @@ +package net.sf.jabref.model.groups; + +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import net.sf.jabref.logic.util.OptionalUtil; +import net.sf.jabref.model.entry.BibEntry; +import net.sf.jabref.model.entry.KeywordList; + +public class AutomaticKeywordGroup extends AutomaticGroup { + + private Character keywordSeperator; + private String field; + + public AutomaticKeywordGroup(String name, GroupHierarchyType context, String field, Character keywordSeperator) { + super(name, context); + this.field = field; + this.keywordSeperator = keywordSeperator; + } + + public Character getKeywordSeperator() { + return keywordSeperator; + } + + public String getField() { + return field; + } + + @Override + public AbstractGroup deepCopy() { + return new AutomaticKeywordGroup(this.name, this.context, field, this.keywordSeperator); + } + + @Override + public Set createSubgroups(BibEntry entry) { + Optional keywordList = entry.getLatexFreeField(field) + .map(fieldValue -> KeywordList.parse(fieldValue, keywordSeperator)); + return OptionalUtil.flatMap(keywordList, KeywordList::toStringList) + .map(keyword -> new WordKeywordGroup(keyword, GroupHierarchyType.INDEPENDENT, field, keyword, true, keywordSeperator, true)) + .map(GroupTreeNode::new) + .collect(Collectors.toSet()); + } +} diff --git a/src/main/java/net/sf/jabref/model/groups/AutomaticPersonsGroup.java b/src/main/java/net/sf/jabref/model/groups/AutomaticPersonsGroup.java new file mode 100644 index 00000000000..142e335b1bf --- /dev/null +++ b/src/main/java/net/sf/jabref/model/groups/AutomaticPersonsGroup.java @@ -0,0 +1,43 @@ +package net.sf.jabref.model.groups; + +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import net.sf.jabref.logic.util.OptionalUtil; +import net.sf.jabref.model.entry.Author; +import net.sf.jabref.model.entry.AuthorList; +import net.sf.jabref.model.entry.BibEntry; + +public class AutomaticPersonsGroup extends AutomaticGroup { + + private String field; + + public AutomaticPersonsGroup(String name, GroupHierarchyType context, String field) { + super(name, context); + this.field = field; + } + + @Override + public AbstractGroup deepCopy() { + return new AutomaticPersonsGroup(this.name, this.context, this.field); + } + + @Override + public Set createSubgroups(BibEntry entry) { + Optional authorList = entry.getLatexFreeField(field) + .map(AuthorList::parse); + return OptionalUtil.flatMap(authorList, AuthorList::getAuthors) + .map(Author::getLast) + .filter(Optional::isPresent) + .map(Optional::get) + .filter(lastName -> !lastName.isEmpty()) + .map(lastName -> new WordKeywordGroup(lastName, GroupHierarchyType.INDEPENDENT, field, lastName, true, ' ', true)) + .map(GroupTreeNode::new) + .collect(Collectors.toSet()); + } + + public String getField() { + return field; + } +} diff --git a/src/test/java/net/sf/jabref/gui/groups/GroupNodeViewModelTest.java b/src/test/java/net/sf/jabref/gui/groups/GroupNodeViewModelTest.java new file mode 100644 index 00000000000..c271c11dde8 --- /dev/null +++ b/src/test/java/net/sf/jabref/gui/groups/GroupNodeViewModelTest.java @@ -0,0 +1,40 @@ +package net.sf.jabref.gui.groups; + +import javafx.collections.FXCollections; + +import net.sf.jabref.gui.StateManager; +import net.sf.jabref.model.database.BibDatabaseContext; +import net.sf.jabref.model.groups.AbstractGroup; +import net.sf.jabref.model.groups.GroupHierarchyType; +import net.sf.jabref.model.groups.WordKeywordGroup; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class GroupNodeViewModelTest { + + private StateManager stateManager; + private BibDatabaseContext databaseContext; + + @Before + public void setUp() throws Exception { + stateManager = mock(StateManager.class); + when(stateManager.getSelectedEntries()).thenReturn(FXCollections.emptyObservableList()); + databaseContext = new BibDatabaseContext(); + } + + @Test + public void getDisplayNameConvertsLatexToUnicode() throws Exception { + GroupNodeViewModel viewModel = getViewModelForGroup( + new WordKeywordGroup("\beta", GroupHierarchyType.INDEPENDENT, "test", "search", true, ',', false)); + assertEquals("baeiabb", viewModel.getDisplayName()); + } + + private GroupNodeViewModel getViewModelForGroup(AbstractGroup group) { + return new GroupNodeViewModel(databaseContext, stateManager, group); + } +} diff --git a/src/test/java/net/sf/jabref/gui/groups/GroupsUtilTest.java b/src/test/java/net/sf/jabref/gui/groups/GroupsUtilTest.java deleted file mode 100644 index 87fbf2ea5e1..00000000000 --- a/src/test/java/net/sf/jabref/gui/groups/GroupsUtilTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package net.sf.jabref.gui.groups; - -import java.io.BufferedReader; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import net.sf.jabref.logic.importer.ParserResult; -import net.sf.jabref.logic.importer.fileformat.BibtexParser; -import net.sf.jabref.model.database.BibDatabase; -import net.sf.jabref.preferences.JabRefPreferences; - -import org.junit.Assert; -import org.junit.Test; - -public class GroupsUtilTest { - - - @Test - public void test() throws IOException { - try (BufferedReader fr = Files.newBufferedReader(Paths.get("src/test/resources/testbib/testjabref.bib"), - StandardCharsets.UTF_8)) { - - ParserResult result = new BibtexParser(JabRefPreferences.getInstance().getImportFormatPreferences()).parse(fr); - - BibDatabase db = result.getDatabase(); - - List fieldList = new ArrayList<>(); - fieldList.add("author"); - - Set authorSet = AutoGroupDialog.findAuthorLastNames(db, fieldList); - Assert.assertTrue(authorSet.contains("Brewer")); - Assert.assertEquals(15, authorSet.size()); - - Set keywordSet = AutoGroupDialog.findDeliminatedWordsInField(db, "keywords", ";"); - Assert.assertTrue(keywordSet.contains("Brain")); - Assert.assertEquals(60, keywordSet.size()); - - Set wordSet = AutoGroupDialog.findAllWordsInField(db, "month", ""); - Assert.assertTrue(wordSet.contains("Feb")); - Assert.assertTrue(wordSet.contains("Mar")); - Assert.assertTrue(wordSet.contains("May")); - Assert.assertTrue(wordSet.contains("Jul")); - Assert.assertTrue(wordSet.contains("Dec")); - Assert.assertEquals(5, wordSet.size()); - } - } - -} diff --git a/src/test/java/net/sf/jabref/model/groups/AutomaticGroupTest.java b/src/test/java/net/sf/jabref/model/groups/AutomaticKeywordGroupTest.java similarity index 76% rename from src/test/java/net/sf/jabref/model/groups/AutomaticGroupTest.java rename to src/test/java/net/sf/jabref/model/groups/AutomaticKeywordGroupTest.java index 77476748609..06995d51c5f 100644 --- a/src/test/java/net/sf/jabref/model/groups/AutomaticGroupTest.java +++ b/src/test/java/net/sf/jabref/model/groups/AutomaticKeywordGroupTest.java @@ -1,20 +1,19 @@ package net.sf.jabref.model.groups; import java.util.HashSet; -import java.util.List; import java.util.Set; import net.sf.jabref.model.entry.BibEntry; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; -public class AutomaticGroupTest { +public class AutomaticKeywordGroupTest { @Test public void createSubgroupsForTwoKeywords() throws Exception { - AutomaticGroup keywordsGroup = new AutomaticGroup("Keywords", GroupHierarchyType.INDEPENDENT, "keywords", ','); + AutomaticKeywordGroup keywordsGroup = new AutomaticKeywordGroup("Keywords", GroupHierarchyType.INDEPENDENT, "keywords", ','); BibEntry entry = new BibEntry().withField("keywords", "A, B"); Set expected = new HashSet<>(); From f1f0a3a65c17e8582f0aaadbf8c2391493de9bc4 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 17 Feb 2017 17:28:48 +0100 Subject: [PATCH 3/5] Fix build and language files --- .../org/jabref/gui/groups/GroupDialog.java | 2 + .../jabref/gui/groups/GroupNodeViewModel.java | 3 + .../jabref/model/database/BibDatabase.java | 81 +++++++++---------- .../jabref/model/groups/AutomaticGroup.java | 4 +- .../model/groups/AutomaticKeywordGroup.java | 8 +- .../model/groups/AutomaticPersonsGroup.java | 10 +-- src/main/resources/l10n/JabRef_da.properties | 9 --- src/main/resources/l10n/JabRef_de.properties | 9 --- src/main/resources/l10n/JabRef_en.properties | 9 --- src/main/resources/l10n/JabRef_es.properties | 9 --- src/main/resources/l10n/JabRef_fa.properties | 9 --- src/main/resources/l10n/JabRef_fr.properties | 9 --- src/main/resources/l10n/JabRef_in.properties | 9 --- src/main/resources/l10n/JabRef_it.properties | 9 --- src/main/resources/l10n/JabRef_ja.properties | 9 --- src/main/resources/l10n/JabRef_nl.properties | 9 --- src/main/resources/l10n/JabRef_no.properties | 9 --- .../resources/l10n/JabRef_pt_BR.properties | 9 --- src/main/resources/l10n/JabRef_ru.properties | 9 --- src/main/resources/l10n/JabRef_sv.properties | 9 --- src/main/resources/l10n/JabRef_tr.properties | 9 --- src/main/resources/l10n/JabRef_vi.properties | 9 --- src/main/resources/l10n/JabRef_zh.properties | 9 --- .../gui/groups/GroupNodeViewModelTest.java | 12 +-- .../groups/AutomaticKeywordGroupTest.java | 4 +- 25 files changed, 60 insertions(+), 217 deletions(-) rename src/main/java/{net/sf => org}/jabref/model/groups/AutomaticGroup.java (84%) rename src/main/java/{net/sf => org}/jabref/model/groups/AutomaticKeywordGroup.java (88%) rename src/main/java/{net/sf => org}/jabref/model/groups/AutomaticPersonsGroup.java (84%) rename src/test/java/{net/sf => org}/jabref/gui/groups/GroupNodeViewModelTest.java (79%) rename src/test/java/{net/sf => org}/jabref/model/groups/AutomaticKeywordGroupTest.java (91%) diff --git a/src/main/java/org/jabref/gui/groups/GroupDialog.java b/src/main/java/org/jabref/gui/groups/GroupDialog.java index 29fe7b2a6f3..e5713c36c45 100644 --- a/src/main/java/org/jabref/gui/groups/GroupDialog.java +++ b/src/main/java/org/jabref/gui/groups/GroupDialog.java @@ -38,6 +38,8 @@ import org.jabref.logic.search.SearchQuery; import org.jabref.model.entry.FieldName; import org.jabref.model.groups.AbstractGroup; +import org.jabref.model.groups.AutomaticKeywordGroup; +import org.jabref.model.groups.AutomaticPersonsGroup; import org.jabref.model.groups.ExplicitGroup; import org.jabref.model.groups.GroupHierarchyType; import org.jabref.model.groups.RegexKeywordGroup; diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index ee2702aa718..68845c0f47d 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -19,10 +19,13 @@ import org.jabref.gui.StateManager; import org.jabref.gui.util.BindingsHelper; import org.jabref.logic.l10n.Localization; +import org.jabref.logic.layout.format.LatexToUnicodeFormatter; import org.jabref.model.database.BibDatabaseContext; +import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.event.EntryEvent; import org.jabref.model.groups.AbstractGroup; import org.jabref.model.groups.AllEntriesGroup; +import org.jabref.model.groups.AutomaticGroup; import org.jabref.model.groups.GroupTreeNode; import com.google.common.eventbus.Subscribe; diff --git a/src/main/java/org/jabref/model/database/BibDatabase.java b/src/main/java/org/jabref/model/database/BibDatabase.java index a2d0963f028..ff9a1593141 100644 --- a/src/main/java/org/jabref/model/database/BibDatabase.java +++ b/src/main/java/org/jabref/model/database/BibDatabase.java @@ -4,7 +4,6 @@ import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; @@ -17,6 +16,9 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; + import org.jabref.model.database.event.EntryAddedEvent; import org.jabref.model.database.event.EntryRemovedEvent; import org.jabref.model.entry.BibEntry; @@ -39,37 +41,47 @@ */ public class BibDatabase { private static final Log LOGGER = LogFactory.getLog(BibDatabase.class); - + private static final Pattern RESOLVE_CONTENT_PATTERN = Pattern.compile(".*#[^#]+#.*"); /** * State attributes */ private final ObservableList entries = FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); - - private String preamble; - // All file contents below the last entry in the file - private String epilog = ""; private final Map bibtexStrings = new ConcurrentHashMap<>(); - /** * this is kept in sync with the database (upon adding/removing an entry, it is updated as well) */ private final DuplicationChecker duplicationChecker = new DuplicationChecker(); - /** * contains all entry.getID() of the current database */ private final Set internalIDs = new HashSet<>(); - private final EventBus eventBus = new EventBus(); - + private String preamble; + // All file contents below the last entry in the file + private String epilog = ""; private String sharedDatabaseID; - public BibDatabase() { this.eventBus.register(duplicationChecker); this.registerListener(new KeyChangeListener(this)); } + /** + * @param toResolve maybenull The text to resolve. + * @param database maybenull The database to use for resolving the text. + * @return The resolved text or the original text if either the text or the database are null + * @deprecated use {@link BibDatabase#resolveForStrings(String)} + * + * Returns a text with references resolved according to an optionally given database. + */ + @Deprecated + public static String getText(String toResolve, BibDatabase database) { + if ((toResolve != null) && (database != null)) { + return database.resolveForStrings(toResolve); + } + return toResolve; + } + /** * Returns the number of entries. */ @@ -222,13 +234,6 @@ public synchronized void removeEntry(BibEntry toBeDeleted, EntryEventSource even } } - /** - * Sets the database's preamble. - */ - public synchronized void setPreamble(String preamble) { - this.preamble = preamble; - } - /** * Returns the database's preamble. * If the preamble text consists only of whitespace, then also an empty optional is returned. @@ -241,6 +246,13 @@ public synchronized Optional getPreamble() { } } + /** + * Sets the database's preamble. + */ + public synchronized void setPreamble(String preamble) { + this.preamble = preamble; + } + /** * Inserts a Bibtex String. */ @@ -467,10 +479,6 @@ private String resolveString(String label, Set usedIds, Set allU } } - - private static final Pattern RESOLVE_CONTENT_PATTERN = Pattern.compile(".*#[^#]+#.*"); - - private String resolveContent(String result, Set usedIds, Set allUsedIds) { String res = result; if (RESOLVE_CONTENT_PATTERN.matcher(res).matches()) { @@ -519,31 +527,14 @@ private String resolveContent(String result, Set usedIds, Set al return res; } - /** - * @deprecated use {@link BibDatabase#resolveForStrings(String)} - * - * Returns a text with references resolved according to an optionally given database. - * - * @param toResolve maybenull The text to resolve. - * @param database maybenull The database to use for resolving the text. - * @return The resolved text or the original text if either the text or the database are null - */ - @Deprecated - public static String getText(String toResolve, BibDatabase database) { - if ((toResolve != null) && (database != null)) { - return database.resolveForStrings(toResolve); - } - return toResolve; + public String getEpilog() { + return epilog; } public void setEpilog(String epilog) { this.epilog = epilog; } - public String getEpilog() { - return epilog; - } - /** * Registers an listener object (subscriber) to the internal event bus. * The following events are posted: @@ -584,14 +575,14 @@ public Optional getSharedDatabaseID() { return Optional.ofNullable(this.sharedDatabaseID); } - public boolean isShared() { - return getSharedDatabaseID().isPresent(); - } - public void setSharedDatabaseID(String sharedDatabaseID) { this.sharedDatabaseID = sharedDatabaseID; } + public boolean isShared() { + return getSharedDatabaseID().isPresent(); + } + public void clearSharedDatabaseID() { this.sharedDatabaseID = null; } diff --git a/src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java b/src/main/java/org/jabref/model/groups/AutomaticGroup.java similarity index 84% rename from src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java rename to src/main/java/org/jabref/model/groups/AutomaticGroup.java index 71f647bb010..62d619fa5cf 100644 --- a/src/main/java/net/sf/jabref/model/groups/AutomaticGroup.java +++ b/src/main/java/org/jabref/model/groups/AutomaticGroup.java @@ -1,8 +1,8 @@ -package net.sf.jabref.model.groups; +package org.jabref.model.groups; import java.util.Set; -import net.sf.jabref.model.entry.BibEntry; +import org.jabref.model.entry.BibEntry; public abstract class AutomaticGroup extends AbstractGroup { public AutomaticGroup(String name, GroupHierarchyType context) { diff --git a/src/main/java/net/sf/jabref/model/groups/AutomaticKeywordGroup.java b/src/main/java/org/jabref/model/groups/AutomaticKeywordGroup.java similarity index 88% rename from src/main/java/net/sf/jabref/model/groups/AutomaticKeywordGroup.java rename to src/main/java/org/jabref/model/groups/AutomaticKeywordGroup.java index f7b7d2ff5c7..1f6c2434a8b 100644 --- a/src/main/java/net/sf/jabref/model/groups/AutomaticKeywordGroup.java +++ b/src/main/java/org/jabref/model/groups/AutomaticKeywordGroup.java @@ -1,12 +1,12 @@ -package net.sf.jabref.model.groups; +package org.jabref.model.groups; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import net.sf.jabref.logic.util.OptionalUtil; -import net.sf.jabref.model.entry.BibEntry; -import net.sf.jabref.model.entry.KeywordList; +import org.jabref.logic.util.OptionalUtil; +import org.jabref.model.entry.BibEntry; +import org.jabref.model.entry.KeywordList; public class AutomaticKeywordGroup extends AutomaticGroup { diff --git a/src/main/java/net/sf/jabref/model/groups/AutomaticPersonsGroup.java b/src/main/java/org/jabref/model/groups/AutomaticPersonsGroup.java similarity index 84% rename from src/main/java/net/sf/jabref/model/groups/AutomaticPersonsGroup.java rename to src/main/java/org/jabref/model/groups/AutomaticPersonsGroup.java index 142e335b1bf..1d6b4a908eb 100644 --- a/src/main/java/net/sf/jabref/model/groups/AutomaticPersonsGroup.java +++ b/src/main/java/org/jabref/model/groups/AutomaticPersonsGroup.java @@ -1,13 +1,13 @@ -package net.sf.jabref.model.groups; +package org.jabref.model.groups; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import net.sf.jabref.logic.util.OptionalUtil; -import net.sf.jabref.model.entry.Author; -import net.sf.jabref.model.entry.AuthorList; -import net.sf.jabref.model.entry.BibEntry; +import org.jabref.logic.util.OptionalUtil; +import org.jabref.model.entry.Author; +import org.jabref.model.entry.AuthorList; +import org.jabref.model.entry.BibEntry; public class AutomaticPersonsGroup extends AutomaticGroup { diff --git a/src/main/resources/l10n/JabRef_da.properties b/src/main/resources/l10n/JabRef_da.properties index d60a79c4192..b2852ccb5cc 100644 --- a/src/main/resources/l10n/JabRef_da.properties +++ b/src/main/resources/l10n/JabRef_da.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Autolink_kun_filer_med_navn_som_sv Automatically_create_groups=Generer_grupper_automatisk -Automatically_create_groups_for_library.=Generer_grupper_for_libraryn. - -Automatically_created_groups=Genererede_grupper_automatisk - Automatically_remove_exact_duplicates=Fjern_eksakte_dubletter_automatisk Allow_overwriting_existing_links.=Tillad_overskrivning_af_eksisterende_links. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Ændrede_brugerfladeindstillinger Changed_preamble=Ændrede_præambel -Characters_to_ignore=Ignorer_følgende_tegn - Check_existing_file_links=Tjek_eksisterende_fil-links Check_links=Tjek_eksterne_links @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Kunne_ikke_køre_'vim'-programmet Could_not_save_file.=Kunne_ikke_gemme_fil. Character_encoding_'%0'_is_not_supported.=Tegnkodingen_'%0'_er_ikke_understøttet. -Created_groups.=Oprettede_grupper. - crossreferenced_entries_included=refererede_poster_inkluderet Current_content=Nuværende_indhold @@ -1468,7 +1460,6 @@ Metadata_change=Metadata-ændring Changes_have_been_made_to_the_following_metadata_elements=Der_er_ændringer_i_følgende_metadata-elementer Generate_groups_for_author_last_names=Generer_grupper_for_forfatteres_efternavne -Generate_groups_for_editor_last_names=Generer_grupper_for_redaktørers_efternavne Generate_groups_from_keywords_in_a_BibTeX_field=Generer_grupper_ud_fra_nøgleord_i_et_BibTeX-felt Enforce_legal_characters_in_BibTeX_keys=Håndhæv_tilladte_tegn_i_BibTeX-nøgler diff --git a/src/main/resources/l10n/JabRef_de.properties b/src/main/resources/l10n/JabRef_de.properties index bf15facf2ba..f5699718fb4 100644 --- a/src/main/resources/l10n/JabRef_de.properties +++ b/src/main/resources/l10n/JabRef_de.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Nur_Dateien_verlinken,_deren_Namen Automatically_create_groups=Gruppen_automatisch_erstellen -Automatically_create_groups_for_library.=Automatisch_Gruppen_für_die_Datenbank_anlegen. - -Automatically_created_groups=Automatisch_erzeugte_Gruppen - Automatically_remove_exact_duplicates=Exakte_Duplikate_automatisch_löschen Allow_overwriting_existing_links.=Vorhandene_Links_überschreiben. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings="Look_and_Feel"-Einstellungen_geändert Changed_preamble=Präambel_geändert -Characters_to_ignore=Folgende_Zeichen_ignorieren - Check_existing_file_links=Existierende_Datei-Links_überprüfen Check_links=Links_überprüfen @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Das_Programm_'vim'_konnte_nicht_gestartet_werde Could_not_save_file.=Datei_konnte_nicht_gespeichert_werden. Character_encoding_'%0'_is_not_supported.=Die_Zeichenkodierung_'%0'_wird_nicht_unterstützt. -Created_groups.=Gruppen_erstellt. - crossreferenced_entries_included=Inklusive_querverwiesenen_Einträgen Current_content=Aktueller_Inhalt @@ -1468,7 +1460,6 @@ Metadata_change=Metadaten-Änderung Changes_have_been_made_to_the_following_metadata_elements=An_den_folgenden_Metadaten_wurden_Änderungen_vorgenommen Generate_groups_for_author_last_names=Erstelle_Gruppen_für_Nachnamen_der_Autoren -Generate_groups_for_editor_last_names=Erstelle_Gruppen_für_Nachnamen_der_Herausgeber Generate_groups_from_keywords_in_a_BibTeX_field=Erstelle_Gruppen_aus_den_Stichwörtern_eines_BibTeX-Feldes Enforce_legal_characters_in_BibTeX_keys=Erzwinge_erlaubte_Zeichen_in_BibTeX-Keys diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index e12ee39d079..dbc733748fb 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Autolink_only_files_that_match_the Automatically_create_groups=Automatically_create_groups -Automatically_create_groups_for_library.=Automatically_create_groups_for_library. - -Automatically_created_groups=Automatically_created_groups - Automatically_remove_exact_duplicates=Automatically_remove_exact_duplicates Allow_overwriting_existing_links.=Allow_overwriting_existing_links. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Changed_look_and_feel_settings Changed_preamble=Changed_preamble -Characters_to_ignore=Characters_to_ignore - Check_existing_file_links=Check_existing_file_links Check_links=Check_links @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Could_not_run_the_'vim'_program. Could_not_save_file.=Could_not_save_file. Character_encoding_'%0'_is_not_supported.=Character_encoding_'%0'_is_not_supported. -Created_groups.=Created_groups. - crossreferenced_entries_included=crossreferenced_entries_included Current_content=Current_content @@ -1468,7 +1460,6 @@ Metadata_change=Metadata_change Changes_have_been_made_to_the_following_metadata_elements=Changes_have_been_made_to_the_following_metadata_elements Generate_groups_for_author_last_names=Generate_groups_for_author_last_names -Generate_groups_for_editor_last_names=Generate_groups_for_editor_last_names Generate_groups_from_keywords_in_a_BibTeX_field=Generate_groups_from_keywords_in_a_BibTeX_field Enforce_legal_characters_in_BibTeX_keys=Enforce_legal_characters_in_BibTeX_keys diff --git a/src/main/resources/l10n/JabRef_es.properties b/src/main/resources/l10n/JabRef_es.properties index 4b44a5cc7cf..3dcb76439f0 100644 --- a/src/main/resources/l10n/JabRef_es.properties +++ b/src/main/resources/l10n/JabRef_es.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Autoenlazar_sólo_archivos_cuyo_no Automatically_create_groups=Crear_grupos_automáticamente -Automatically_create_groups_for_library.=Crear_grupos_para_base_de_datos_automáticamente - -Automatically_created_groups=Grupos_automáticamente_creados - Automatically_remove_exact_duplicates=Eliminar_automáticamente_duplicados_exactos Allow_overwriting_existing_links.=Permitir_sobreescribir_enlaces_existentes. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Ajustes_de_aspecto_cambiados Changed_preamble=Preámbulo_cambiado -Characters_to_ignore=Caracteres_a_ignorar - Check_existing_file_links=Comprobar_archivo_enlaces_existentes Check_links=Comprobar_enlaces @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=No_se_puede_ejecutar_Vim Could_not_save_file.=No_se_puede_guardar_el_archivo. Character_encoding_'%0'_is_not_supported.=La_codificaciónd_de_caracteres_'%0'_no_está_soportada. -Created_groups.=Grupos_creados. - crossreferenced_entries_included=entradas_de_referencia_cruzada_incluídas Current_content=Contenido_actual @@ -1468,7 +1460,6 @@ Metadata_change=Cambio_de_metadatos Changes_have_been_made_to_the_following_metadata_elements=Se_han_efectuado_los_cambios_a_los_siguientes_elementos_de_los_metadatos Generate_groups_for_author_last_names=Generar_grupos_para_apellidos_de_autor -Generate_groups_for_editor_last_names=Generar_grupos_para_apellidos_de_editor Generate_groups_from_keywords_in_a_BibTeX_field=Generar_grupos_desde_palabras_claves_de_un_campo_BibTeX Enforce_legal_characters_in_BibTeX_keys=Uso_obligado_de_caracteres_legales_en_claves_BibTeX diff --git a/src/main/resources/l10n/JabRef_fa.properties b/src/main/resources/l10n/JabRef_fa.properties index 1cf411b6642..307ec3b72ba 100644 --- a/src/main/resources/l10n/JabRef_fa.properties +++ b/src/main/resources/l10n/JabRef_fa.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key= Automatically_create_groups= -Automatically_create_groups_for_library.= - -Automatically_created_groups= - Automatically_remove_exact_duplicates= Allow_overwriting_existing_links.= @@ -209,8 +205,6 @@ Changed_look_and_feel_settings= Changed_preamble= -Characters_to_ignore= - Check_existing_file_links= Check_links= @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.= Could_not_save_file.= Character_encoding_'%0'_is_not_supported.= -Created_groups.= - crossreferenced_entries_included= Current_content= @@ -1468,7 +1460,6 @@ Metadata_change= Changes_have_been_made_to_the_following_metadata_elements= Generate_groups_for_author_last_names= -Generate_groups_for_editor_last_names= Generate_groups_from_keywords_in_a_BibTeX_field= Enforce_legal_characters_in_BibTeX_keys= diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index bb4f3a9f105..7581c098fa2 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Lier_automatiquement_les_fichiers_ Automatically_create_groups=Créer_automatiquement_des_groupes -Automatically_create_groups_for_library.=Créer_automatiquement_des_groupes_pour_le_fichier. - -Automatically_created_groups=Groupes_créés_automatiquement - Automatically_remove_exact_duplicates=Supprimer_automatiquement_les_doublons_identiques Allow_overwriting_existing_links.=Ecraser_les_liens_existants. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Changer_les_paramètres_d'apparence Changed_preamble=Préambule_modifié -Characters_to_ignore=Caractères_à_ignorer - Check_existing_file_links=Vérifier_les_liens_fichier_existants Check_links=Vérifier_les_liens @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Le_programme_'vim'_n'a_pas_pu_être_lancé. Could_not_save_file.=Le_fichier_n'a_pas_pu_être_enregistré_. Character_encoding_'%0'_is_not_supported.=L'encodage_de_caractères_'%0'_n'est_pas_supporté. -Created_groups.=Groupes_créés. - crossreferenced_entries_included=Entrées_avec_références_croisées_incluses Current_content=Contenu_actuel @@ -1468,7 +1460,6 @@ Metadata_change=Changement_dans_les_métadonnées Changes_have_been_made_to_the_following_metadata_elements=Des_modifications_ont_été_faites_aux_éléments_de_métadonnées_suivants Generate_groups_for_author_last_names=Création_de_groupes_pour_les_noms_d'auteurs -Generate_groups_for_editor_last_names=Création_de_groupes_pour_les_noms_d'éditeurs Generate_groups_from_keywords_in_a_BibTeX_field=Création_de_groupes_à_partir_de_mots-clefs_d'un_champ_BibTeX Enforce_legal_characters_in_BibTeX_keys=Imposer_des_caractères_légaux_dans_les_clefs_BibTeX diff --git a/src/main/resources/l10n/JabRef_in.properties b/src/main/resources/l10n/JabRef_in.properties index c3eaf37417c..f7a2148fd06 100644 --- a/src/main/resources/l10n/JabRef_in.properties +++ b/src/main/resources/l10n/JabRef_in.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Tautan_otomatis_hanya_pada_berkas_ Automatically_create_groups=Otomatis_membuat_grup -Automatically_create_groups_for_library.=Otomatis_membuat_grup_untuk_basisdata. - -Automatically_created_groups=Grup_yang_dibuat_otomatis - Automatically_remove_exact_duplicates=Otomatis_menghapus_yang_sama Allow_overwriting_existing_links.=Mengijinkan_menindih_tautan_yang_ada. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Pengaturan_penampilan_berubah Changed_preamble=Preamble_berubah -Characters_to_ignore=Karakter_diabaikan - Check_existing_file_links=Periksa_berkas_tautan_yang_sudah_ada Check_links=Periksa_tautan @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Tidak_bisa_menjalankan_program_'vim'. Could_not_save_file.=Tidak_bisa_membuka_berkas. Character_encoding_'%0'_is_not_supported.=Enkoding_karakter_'%0'_tidak_didukung. -Created_groups.=Grup_dibuat. - crossreferenced_entries_included=entri_referensi_silang_diikutkan Current_content=Isi_sekarang @@ -1468,7 +1460,6 @@ Metadata_change=Perubahan_Metadata Changes_have_been_made_to_the_following_metadata_elements=Perubahan_telah_dilakukan_pada_elemen_metadata_berikut Generate_groups_for_author_last_names=Membuat_grup_untuk_nama_belakang_penulis -Generate_groups_for_editor_last_names=Membuat_grup_untuk_nama_belakang_penyunting Generate_groups_from_keywords_in_a_BibTeX_field=Membuat_grup_dari_katakunci_di_bidang_BibTeX Enforce_legal_characters_in_BibTeX_keys=Menggunakan_karakter_legal_untuk_kunci_BibTeX diff --git a/src/main/resources/l10n/JabRef_it.properties b/src/main/resources/l10n/JabRef_it.properties index c55080529f3..2f674c5d06a 100644 --- a/src/main/resources/l10n/JabRef_it.properties +++ b/src/main/resources/l10n/JabRef_it.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Collegare_automaticamente_solo_i_f Automatically_create_groups=Crea_automaticamente_i_gruppi -Automatically_create_groups_for_library.=Crea_automaticamente_i_gruppi_per_il_library - -Automatically_created_groups=Gruppi_creati_automaticamente - Automatically_remove_exact_duplicates=Rimuovi_automaticamente_i_duplicati_esatti Allow_overwriting_existing_links.=Consenti_la_sovrascrittura_dei_collegamenti_esistenti. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Parametri_del_"Look-and-Feel"_modificati Changed_preamble=Preambolo_modificato -Characters_to_ignore=Caratteri_da_ignorare - Check_existing_file_links=Verificare_i_collegamenti_a_file_esistenti Check_links=Verifica_i_collegamenti @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Impossibile_eseguire_il_programma_'vim'. Could_not_save_file.=Impossibile_salvare_il_file. Character_encoding_'%0'_is_not_supported.=La_codifica_dei_caratteri_'%0'_non_è_supportata. -Created_groups.=Gruppi_creati - crossreferenced_entries_included=Incluse_le_voci_con_riferimenti_incrociati Current_content=Contenuto_corrente @@ -1468,7 +1460,6 @@ Metadata_change=Modifica_dei_metadati Changes_have_been_made_to_the_following_metadata_elements=Sono_stati_modificati_i_seguenti_elementi_dei_metadati Generate_groups_for_author_last_names=Genera_gruppi_in_base_al_cognome_dell'autore -Generate_groups_for_editor_last_names=Genera_gruppi_in_base_al_cognome_del_curatore Generate_groups_from_keywords_in_a_BibTeX_field=Genera_gruppi_in_base_alle_parole_chiave_in_un_campo_BibTeX Enforce_legal_characters_in_BibTeX_keys=Imponi_l'utilizzo_dei_soli_caratteri_conformi_alla_sintassi_nelle_chiavi_BibTeX diff --git a/src/main/resources/l10n/JabRef_ja.properties b/src/main/resources/l10n/JabRef_ja.properties index e6dbe9539b2..a13b8b951db 100644 --- a/src/main/resources/l10n/JabRef_ja.properties +++ b/src/main/resources/l10n/JabRef_ja.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=BibTeX鍵に一致するファイ Automatically_create_groups=グループを自動生成 -Automatically_create_groups_for_library.=データベースのグループを自動生成 - -Automatically_created_groups=グループを自動生成しました - Automatically_remove_exact_duplicates=完全に同一な重複を自動削除 Allow_overwriting_existing_links.=既存リンクの上書きを許可する。 @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=操作性設定を変更しました Changed_preamble=プリアンブルを変更しました -Characters_to_ignore=無視する文字 - Check_existing_file_links=既存のファイルリンクを確認 Check_links=リンクを確認 @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=「vim」プログラムを実行できませ Could_not_save_file.=ファイルを保存できませんでした Character_encoding_'%0'_is_not_supported.=。文字エンコーディング「%0」はサポートされていません。 -Created_groups.=グループを生成しました。 - crossreferenced_entries_included=相互参照している項目を取り込みました Current_content=現在の内容 @@ -1468,7 +1460,6 @@ Metadata_change=メタデータの変更 Changes_have_been_made_to_the_following_metadata_elements=以下のメタデータ要素に変更を加えました Generate_groups_for_author_last_names=著者の姓でグループを生成する -Generate_groups_for_editor_last_names=編集者の姓でグループを生成する Generate_groups_from_keywords_in_a_BibTeX_field=BibTeXフィールドのキーワードからグループを生成する Enforce_legal_characters_in_BibTeX_keys=BibTeX鍵で規則に則った文字の使用を強制する diff --git a/src/main/resources/l10n/JabRef_nl.properties b/src/main/resources/l10n/JabRef_nl.properties index 8760f9b9133..fe71d3f2c32 100644 --- a/src/main/resources/l10n/JabRef_nl.properties +++ b/src/main/resources/l10n/JabRef_nl.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key= Automatically_create_groups=Groepen_automatisch_aanmaken -Automatically_create_groups_for_library.=Automatisch_groepen_voor_library_aanmaken - -Automatically_created_groups=Automatisch_aangemaakte_groepen - Automatically_remove_exact_duplicates=Automatisch_exacte_kopie\u00ebn_verwijderen Allow_overwriting_existing_links.=Overschrijven_van_bestaande_snelkoppelingen_toestaan. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Gewijzigde_"Look_and_Feel"-instellingen Changed_preamble=Gewijzigde_inleiding -Characters_to_ignore=Tekens_die_genegeerd_worden - Check_existing_file_links=Controleer_bestaande_bestand_snelkoppelingen Check_links=Controleer_snelkoppelingen @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.= Could_not_save_file.=Kon_het_bestand_niet_opslaan. Character_encoding_'%0'_is_not_supported.= -Created_groups.=Groepen_aangemaakt. - crossreferenced_entries_included=inclusief_kruisgerefereerde_entries Current_content=Huidige_inhoud @@ -1468,7 +1460,6 @@ Metadata_change= Changes_have_been_made_to_the_following_metadata_elements= Generate_groups_for_author_last_names= -Generate_groups_for_editor_last_names= Generate_groups_from_keywords_in_a_BibTeX_field= Enforce_legal_characters_in_BibTeX_keys= diff --git a/src/main/resources/l10n/JabRef_no.properties b/src/main/resources/l10n/JabRef_no.properties index 7bbc374a2cd..924d479536f 100644 --- a/src/main/resources/l10n/JabRef_no.properties +++ b/src/main/resources/l10n/JabRef_no.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Autolink_bare_filer_med_navn_som_s Automatically_create_groups=Generer_grupper_automatisk -Automatically_create_groups_for_library.=Generer_grupper_for_libraryn. - -Automatically_created_groups=Genererte_grupper_automatisk - Automatically_remove_exact_duplicates=Fjern_eksakte_duplikater_automatisk Allow_overwriting_existing_links.=Tillat_overskriving_av_eksisterende_linker. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Endret_oppsett_av_grensesnitt Changed_preamble=Endret_preamble -Characters_to_ignore=Ignorer_f\u00f8lgende_tegn - Check_existing_file_links=Sjekk_eksisterende_fil-linker Check_links=Sjekk_eksterne_linker @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Kunne_ikke_kj\u00f8re_'vim'-programmet Could_not_save_file.= Character_encoding_'%0'_is_not_supported.=Tegnkodingen_'%0'_er_ikke_st\u00f8ttet. -Created_groups.=Opprettet_grupper. - crossreferenced_entries_included=refererte_enheter_inkludert Current_content=N\u00e5v\u00e6rende_innhold @@ -1468,7 +1460,6 @@ Metadata_change=Endring_av_metadata Changes_have_been_made_to_the_following_metadata_elements=Endringer_er_gjort_for_de_f\u00b8lgende_metadata-elementene Generate_groups_for_author_last_names=Generer_grupper_for_etternavn_fra_author-feltet -Generate_groups_for_editor_last_names=Generer_grupper_for_etternavn_fra_editor-feltet Generate_groups_from_keywords_in_a_BibTeX_field=Generer_grupper_fra_n\u00b8kkelord_i_et_BibTeX-felt Enforce_legal_characters_in_BibTeX_keys=Forby_tegn_i_BibTeX-n\u00b8kler_som_ikke_aksepteres_av_BibTeX diff --git a/src/main/resources/l10n/JabRef_pt_BR.properties b/src/main/resources/l10n/JabRef_pt_BR.properties index b414b3ef407..6f1caba6eab 100644 --- a/src/main/resources/l10n/JabRef_pt_BR.properties +++ b/src/main/resources/l10n/JabRef_pt_BR.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Criar_links_automaticamente_soment Automatically_create_groups=Criar_grupos_automaticamente -Automatically_create_groups_for_library.=Criar_grupos_automaticamente_para_a_base_de_dados. - -Automatically_created_groups=Grupos_criados_automaticamente - Automatically_remove_exact_duplicates=Remover_automaticamente_duplicatas_exatas Allow_overwriting_existing_links.=Sobrescrever_links_existentes. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Configurações_do_esquema_de_cores_modificadas Changed_preamble=Preâmbulo_modificado -Characters_to_ignore=Caracteres_para_ignorar - Check_existing_file_links=Verificar_links_de_arquivos_existentes Check_links=Verificar_links @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Não_foi_possível_executar_o_programa_'vim'. Could_not_save_file.=Não_foi_possível_salvar_o_arquivo. Character_encoding_'%0'_is_not_supported.=A_codificação_de_caracteres_'%0'_não_é_suportada. -Created_groups.=Grupos_criados. - crossreferenced_entries_included=Registros_com_referências_cruzadas_incluídos Current_content=Conteúdo_atual @@ -1468,7 +1460,6 @@ Metadata_change=Mudança_de_metadados Changes_have_been_made_to_the_following_metadata_elements=Mudanças_foram_realizadas_nos_seguintes_elementos_de_metadados Generate_groups_for_author_last_names=Gerar_grupos_a_partir_dos_últimos_nomes_dos_autores -Generate_groups_for_editor_last_names=Gerar_grupos_pelos_últimos_nomes_dos_editores Generate_groups_from_keywords_in_a_BibTeX_field=Gerar_grupos_a_partir_de_palavras_chaves_em_um_campo_BibTeX Enforce_legal_characters_in_BibTeX_keys=Forçar_caracteres_permitidos_em_chaves_BibTeX diff --git a/src/main/resources/l10n/JabRef_ru.properties b/src/main/resources/l10n/JabRef_ru.properties index 5ec623f34e7..07f97054afc 100644 --- a/src/main/resources/l10n/JabRef_ru.properties +++ b/src/main/resources/l10n/JabRef_ru.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Автоматическая_пр Automatically_create_groups=Автоматическое_создание_групп -Automatically_create_groups_for_library.=Автоматическое_создание_групп_для_БД. - -Automatically_created_groups=Автоматически_созданные_группы - Automatically_remove_exact_duplicates=Автоматически_удалять_полные_дубликаты Allow_overwriting_existing_links.=Разрешить_перезапись_текущих_ссылок. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Измененные_настройки_инте Changed_preamble=Измененная_преамбула -Characters_to_ignore=Не_учитывать_знаки - Check_existing_file_links=Проверить_текущие_ссылки_файл Check_links=Проверить_ссылки @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Не_удалось_запустить_прил Could_not_save_file.=Не_удалось_сохранить_файл. Character_encoding_'%0'_is_not_supported.=Кодировка_'%0'_не_поддерживается. -Created_groups.=Созданные_группы. - crossreferenced_entries_included=записи_с_перекрестными_ссылками Current_content=Текущее_содержимое @@ -1468,7 +1460,6 @@ Metadata_change=Изменение_метаданных Changes_have_been_made_to_the_following_metadata_elements=Произведены_изменения_для_следующих_элементов_метаданных Generate_groups_for_author_last_names=Создание_групп_для_фамилий_авторов -Generate_groups_for_editor_last_names=Создание_групп_для_фамилий_редакторов Generate_groups_from_keywords_in_a_BibTeX_field=Создание_групп_из_ключевых_слов_в_поле_BibTeX Enforce_legal_characters_in_BibTeX_keys=Принудительное_использование_допустимого_набора_символов_в_ключах_BibTeX diff --git a/src/main/resources/l10n/JabRef_sv.properties b/src/main/resources/l10n/JabRef_sv.properties index dabffcc623e..57c11e27414 100644 --- a/src/main/resources/l10n/JabRef_sv.properties +++ b/src/main/resources/l10n/JabRef_sv.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Länka_bara_filer_vars_namn_är_Bi Automatically_create_groups=Skapa_grupper_automatiskt -Automatically_create_groups_for_library.=Skapa_grupper_automatiskt_för_libraryn. - -Automatically_created_groups=Skapade_grupper_automatiskt - Automatically_remove_exact_duplicates=Ta_bort_exakta_dubbletter_automatiskt Allow_overwriting_existing_links.=Tillåt_att_befintliga_länkar_skrivs_över. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Ändra_inställningar_för_look-and-feel Changed_preamble=Ändrade_preamble -Characters_to_ignore=Bokstäver_att_ignorera - Check_existing_file_links=Kontrollera_befintliga_fillänkar Check_links=Kontrollera_länkar @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Kunde_inte_köra_'vim'. Could_not_save_file.=Kunde_inte_spara_fil. Character_encoding_'%0'_is_not_supported.=Teckenkodningen_'%0'_stöds_inte. -Created_groups.=Skapade_grupper. - crossreferenced_entries_included=korsrefererade_poster_inkluderade Current_content=Nuvarande_innehåll @@ -1468,7 +1460,6 @@ Metadata_change=Ändring_i_metadata Changes_have_been_made_to_the_following_metadata_elements=Ändringar_har_gjorts_i_följande_metadata-element Generate_groups_for_author_last_names=Generera_grupper_baserat_på_författarefternamn -Generate_groups_for_editor_last_names=Generera_grupper_baserat_på_editorefternamn Generate_groups_from_keywords_in_a_BibTeX_field=Generera_grupper_baserat_på_nyckelord_i_ett_fält Enforce_legal_characters_in_BibTeX_keys=Framtvinga_giltiga_tecken_i_BibTeX-nycklar diff --git a/src/main/resources/l10n/JabRef_tr.properties b/src/main/resources/l10n/JabRef_tr.properties index 7001b9c56ff..b589879a560 100644 --- a/src/main/resources/l10n/JabRef_tr.properties +++ b/src/main/resources/l10n/JabRef_tr.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Yalnızca_BibTeX_anahtarıyla_eşl Automatically_create_groups=Grupları_otomatik_oluştur -Automatically_create_groups_for_library.=Veritabanı_için_grupları_otomatik_oluştur - -Automatically_created_groups=Otomatik_oluşturulmuş_gruplar - Automatically_remove_exact_duplicates=Tıpkı_çift_nüshaları_otomatik_sil Allow_overwriting_existing_links.=Mevcut_linklerin_üzerine_yazmaya_izin_ver. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Görünüm_ve_tema_ayarları_değişti Changed_preamble=Öncül_değişti -Characters_to_ignore=Yoksayılacak_karakterler - Check_existing_file_links=Mevcut_dosya_linki_kontrol_ediniz Check_links=Linkleri_kontrol_ediniz @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.='Vim'_programı_çalıştırılamıyor. Could_not_save_file.=Dosya_kaydedilemiyor. Character_encoding_'%0'_is_not_supported.='%0'_karakter_kodlaması_desteklenmiyor. -Created_groups.=Oluşturulmuş_gruplar. - crossreferenced_entries_included=çapraz_bağlantılı_girdiler_dahil_edildi Current_content=Güncel_içerik @@ -1468,7 +1460,6 @@ Metadata_change=Metadata_değişikliği Changes_have_been_made_to_the_following_metadata_elements=Aşağıdaki_metadata_ögelerinde_değişiklik_yapıldı Generate_groups_for_author_last_names=Yazar_soyadları_için_grup_oluştur -Generate_groups_for_editor_last_names=Editör_soyadları_için_grup_oluştur Generate_groups_from_keywords_in_a_BibTeX_field=Bir_BibTeX_alanındaki_anahtar_sözcüklerden_grup_oluştur Enforce_legal_characters_in_BibTeX_keys=BibTeX_anahtarlarında_yasal_karakterleri_zorla diff --git a/src/main/resources/l10n/JabRef_vi.properties b/src/main/resources/l10n/JabRef_vi.properties index 997740e2a8d..79ecb97879c 100644 --- a/src/main/resources/l10n/JabRef_vi.properties +++ b/src/main/resources/l10n/JabRef_vi.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=Chỉ_tự_động_liên_kết_cá Automatically_create_groups=Tự_động_tạo_các_nhóm -Automatically_create_groups_for_library.=Tự_động_tạo_các_nhóm_dùng_cho_CSDL. - -Automatically_created_groups=Các_nhóm_được_tạo_ra_tự_động - Automatically_remove_exact_duplicates=Tự_động_loại_bỏ_các_mục_trùng_nhau Allow_overwriting_existing_links.=Cho_phép_ghi_đè_các_liên_kết_hiện_có. @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=Các_thiết_lập_diện_mạo_được_thay_đ Changed_preamble=Phần_mở_đầu_được_thay_đổi -Characters_to_ignore=Các_ký_tự_bỏ_qua - Check_existing_file_links=Kiểm_tra_tập_tin_liên_kết_hiện_có Check_links=Kiểm_tra_các_liên_kết @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=Không_thể_chạy_chương_trình_'vim'. Could_not_save_file.=Không_thể_lưu_tập_tin. Character_encoding_'%0'_is_not_supported.=Mã_hóa_ký_tự_'%0'_không_được_hỗ_trợ. -Created_groups.=Các_nhóm_được_tạo_ra. - crossreferenced_entries_included=các_mục_có_tham_chiếu_chéo_được_đưa_vào Current_content=Nội_dung_hiện_tại @@ -1468,7 +1460,6 @@ Metadata_change=Thay_đổi_đặc_tả_dữ_liệu Changes_have_been_made_to_the_following_metadata_elements=Các_thay_đổi_đã_được_thực_hiện_cho_những_thành_phần_đặc_tả_CSDL_sau Generate_groups_for_author_last_names=Tạo_các_nhóm_cho_họ_của_tác_giả -Generate_groups_for_editor_last_names=Tạo_các_nhóm_cho_tên_họ_của_người_biên_tập Generate_groups_from_keywords_in_a_BibTeX_field=Tạo_các_nhóm_theo_từ_khóa_trong_một_dữ_liệu_BibTeX Enforce_legal_characters_in_BibTeX_keys=Buộc_phải_dùng_những_ký_tự_hợp_lệ_trong_khóa_BibTeX diff --git a/src/main/resources/l10n/JabRef_zh.properties b/src/main/resources/l10n/JabRef_zh.properties index b438be00661..49cf466eabb 100644 --- a/src/main/resources/l10n/JabRef_zh.properties +++ b/src/main/resources/l10n/JabRef_zh.properties @@ -133,10 +133,6 @@ Autolink_only_files_that_match_the_BibTeX_key=自动链接文件名匹配_BibTeX Automatically_create_groups=自动创建分组 -Automatically_create_groups_for_library.=自动为数据库创建分组。 - -Automatically_created_groups=自动创建的分组 - Automatically_remove_exact_duplicates=自动移除完全重复的项 Allow_overwriting_existing_links.=允许覆盖已有的链接。 @@ -209,8 +205,6 @@ Changed_look_and_feel_settings=已修改显示效果_(look_and_feel)_设置 Changed_preamble=已修改导言区_(preamble) -Characters_to_ignore=要忽略的字符 - Check_existing_file_links=检查存在的文件链接 Check_links=核对链接 @@ -287,8 +281,6 @@ Could_not_run_the_'vim'_program.=无法运行_'vim'_程序。 Could_not_save_file.=无法保存文件 Character_encoding_'%0'_is_not_supported.=,不支持编码_'%0'。 -Created_groups.=建立分组 - crossreferenced_entries_included=包含交叉引用的记录 Current_content=当前内容 @@ -1468,7 +1460,6 @@ Metadata_change=元数据改变 Changes_have_been_made_to_the_following_metadata_elements=下列元数据元素被改变 Generate_groups_for_author_last_names=用作者的姓_(last_name)_创建分组 -Generate_groups_for_editor_last_names=用编者的姓_(last_name)_创建分组 Generate_groups_from_keywords_in_a_BibTeX_field=用_BibTeX_域中的关键词创建分组 Enforce_legal_characters_in_BibTeX_keys=强制在_BibTeX_键值中使用合法字符 diff --git a/src/test/java/net/sf/jabref/gui/groups/GroupNodeViewModelTest.java b/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java similarity index 79% rename from src/test/java/net/sf/jabref/gui/groups/GroupNodeViewModelTest.java rename to src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java index c271c11dde8..75f869bdd5d 100644 --- a/src/test/java/net/sf/jabref/gui/groups/GroupNodeViewModelTest.java +++ b/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java @@ -1,12 +1,12 @@ -package net.sf.jabref.gui.groups; +package org.jabref.gui.groups; import javafx.collections.FXCollections; -import net.sf.jabref.gui.StateManager; -import net.sf.jabref.model.database.BibDatabaseContext; -import net.sf.jabref.model.groups.AbstractGroup; -import net.sf.jabref.model.groups.GroupHierarchyType; -import net.sf.jabref.model.groups.WordKeywordGroup; +import org.jabref.gui.StateManager; +import org.jabref.model.database.BibDatabaseContext; +import org.jabref.model.groups.AbstractGroup; +import org.jabref.model.groups.GroupHierarchyType; +import org.jabref.model.groups.WordKeywordGroup; import org.junit.Before; import org.junit.Test; diff --git a/src/test/java/net/sf/jabref/model/groups/AutomaticKeywordGroupTest.java b/src/test/java/org/jabref/model/groups/AutomaticKeywordGroupTest.java similarity index 91% rename from src/test/java/net/sf/jabref/model/groups/AutomaticKeywordGroupTest.java rename to src/test/java/org/jabref/model/groups/AutomaticKeywordGroupTest.java index 06995d51c5f..aa9b80c496e 100644 --- a/src/test/java/net/sf/jabref/model/groups/AutomaticKeywordGroupTest.java +++ b/src/test/java/org/jabref/model/groups/AutomaticKeywordGroupTest.java @@ -1,9 +1,9 @@ -package net.sf.jabref.model.groups; +package org.jabref.model.groups; import java.util.HashSet; import java.util.Set; -import net.sf.jabref.model.entry.BibEntry; +import org.jabref.model.entry.BibEntry; import org.junit.Test; From 1959991d4934d52b5cb9ab708aa2316249003fac Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 17 Feb 2017 18:01:42 +0100 Subject: [PATCH 4/5] Fix architecture tests --- .../logic/cleanup/MoveFieldCleanup.java | 2 +- .../jabref/logic/integrity/FieldChecker.java | 2 +- .../model/groups/AutomaticKeywordGroup.java | 2 +- .../model/groups/AutomaticPersonsGroup.java | 2 +- .../{logic => model}/util/OptionalUtil.java | 2 +- .../java/org/jabref/ArchitectureTests.java | 30 +++++++++---------- .../gui/groups/GroupNodeViewModelTest.java | 4 +-- 7 files changed, 21 insertions(+), 23 deletions(-) rename src/main/java/org/jabref/{logic => model}/util/OptionalUtil.java (97%) diff --git a/src/main/java/org/jabref/logic/cleanup/MoveFieldCleanup.java b/src/main/java/org/jabref/logic/cleanup/MoveFieldCleanup.java index 1763b9d139b..f59fec41718 100644 --- a/src/main/java/org/jabref/logic/cleanup/MoveFieldCleanup.java +++ b/src/main/java/org/jabref/logic/cleanup/MoveFieldCleanup.java @@ -3,10 +3,10 @@ import java.util.List; import java.util.Optional; -import org.jabref.logic.util.OptionalUtil; import org.jabref.model.FieldChange; import org.jabref.model.cleanup.CleanupJob; import org.jabref.model.entry.BibEntry; +import org.jabref.model.util.OptionalUtil; /** * Moves the content of one field to another field. diff --git a/src/main/java/org/jabref/logic/integrity/FieldChecker.java b/src/main/java/org/jabref/logic/integrity/FieldChecker.java index b0856bdf12a..fe4301e9a0f 100644 --- a/src/main/java/org/jabref/logic/integrity/FieldChecker.java +++ b/src/main/java/org/jabref/logic/integrity/FieldChecker.java @@ -5,8 +5,8 @@ import java.util.Objects; import java.util.Optional; -import org.jabref.logic.util.OptionalUtil; import org.jabref.model.entry.BibEntry; +import org.jabref.model.util.OptionalUtil; public class FieldChecker implements IntegrityCheck.Checker { protected final String field; diff --git a/src/main/java/org/jabref/model/groups/AutomaticKeywordGroup.java b/src/main/java/org/jabref/model/groups/AutomaticKeywordGroup.java index 1f6c2434a8b..48641d24915 100644 --- a/src/main/java/org/jabref/model/groups/AutomaticKeywordGroup.java +++ b/src/main/java/org/jabref/model/groups/AutomaticKeywordGroup.java @@ -4,9 +4,9 @@ import java.util.Set; import java.util.stream.Collectors; -import org.jabref.logic.util.OptionalUtil; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.KeywordList; +import org.jabref.model.util.OptionalUtil; public class AutomaticKeywordGroup extends AutomaticGroup { diff --git a/src/main/java/org/jabref/model/groups/AutomaticPersonsGroup.java b/src/main/java/org/jabref/model/groups/AutomaticPersonsGroup.java index 1d6b4a908eb..5e4be74b20a 100644 --- a/src/main/java/org/jabref/model/groups/AutomaticPersonsGroup.java +++ b/src/main/java/org/jabref/model/groups/AutomaticPersonsGroup.java @@ -4,10 +4,10 @@ import java.util.Set; import java.util.stream.Collectors; -import org.jabref.logic.util.OptionalUtil; import org.jabref.model.entry.Author; import org.jabref.model.entry.AuthorList; import org.jabref.model.entry.BibEntry; +import org.jabref.model.util.OptionalUtil; public class AutomaticPersonsGroup extends AutomaticGroup { diff --git a/src/main/java/org/jabref/logic/util/OptionalUtil.java b/src/main/java/org/jabref/model/util/OptionalUtil.java similarity index 97% rename from src/main/java/org/jabref/logic/util/OptionalUtil.java rename to src/main/java/org/jabref/model/util/OptionalUtil.java index 91b13d1c0ea..d2b482b80ee 100644 --- a/src/main/java/org/jabref/logic/util/OptionalUtil.java +++ b/src/main/java/org/jabref/model/util/OptionalUtil.java @@ -1,4 +1,4 @@ -package org.jabref.logic.util; +package org.jabref.model.util; import java.util.Collection; import java.util.Collections; diff --git a/src/test/java/org/jabref/ArchitectureTests.java b/src/test/java/org/jabref/ArchitectureTests.java index ac7caa38b17..d3b8b1decac 100644 --- a/src/test/java/org/jabref/ArchitectureTests.java +++ b/src/test/java/org/jabref/ArchitectureTests.java @@ -29,21 +29,19 @@ public class ArchitectureTests { private static final String CLASS_ORG_JABREF_GLOBALS = "org.jabref.Globals"; private static final String EXCEPTION_PACKAGE_JAVA_AWT_GEOM = "java.awt.geom"; - - private Map> exceptionStrings; - private final String firstPackage; private final String secondPackage; + private Map> exceptions; public ArchitectureTests(String firstPackage, String secondPackage) { this.firstPackage = firstPackage; this.secondPackage = secondPackage; - //add exceptions for the architectural test here - //Note that bending the architectural constraints should not be done inconsiderately - exceptionStrings = new HashMap<>(); - exceptionStrings.put(PACKAGE_ORG_JABREF_LOGIC, - Arrays.asList(EXCEPTION_PACKAGE_JAVA_AWT_GEOM)); + // Add exceptions for the architectural test here + // Note that bending the architectural constraints should not be done inconsiderately + exceptions = new HashMap<>(); + exceptions.put(PACKAGE_ORG_JABREF_LOGIC, + Collections.singletonList(EXCEPTION_PACKAGE_JAVA_AWT_GEOM)); } @@ -67,9 +65,10 @@ public static Iterable data() { @Test public void firstPackageIsIndependentOfSecondPackage() throws IOException { - Predicate isExceptionPackage = (s) -> s.startsWith("import " + secondPackage) && !(exceptionStrings.get(firstPackage).stream() - .filter(exception -> s.startsWith("import " + exception)).findAny().isPresent() - ); + Predicate isExceptionPackage = (s) -> + s.startsWith("import " + secondPackage) + && exceptions.getOrDefault(firstPackage, Collections.emptyList()).stream() + .noneMatch(exception -> s.startsWith("import " + exception)); Predicate isPackage = (s) -> s.startsWith("package " + firstPackage); @@ -77,22 +76,21 @@ public void firstPackageIsIndependentOfSecondPackage() throws IOException { .filter(p -> p.toString().endsWith(".java")) .filter(p -> { try { - return Files.readAllLines(p, StandardCharsets.UTF_8).stream() - .filter(isPackage).findAny().isPresent(); + return Files.readAllLines(p, StandardCharsets.UTF_8).stream().anyMatch(isPackage); } catch (IOException e) { return false; } }) .filter(p -> { try { - return Files.readAllLines(p, StandardCharsets.UTF_8).stream() - .filter(isExceptionPackage).findAny().isPresent(); + return Files.readAllLines(p, StandardCharsets.UTF_8).stream().anyMatch(isExceptionPackage); } catch (IOException e) { return false; } }).collect(Collectors.toList()); - Assert.assertEquals(Collections.emptyList(), files); + Assert.assertEquals("The following classes are not allowed to depend on " + secondPackage, + Collections.emptyList(), files); } } diff --git a/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java b/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java index 75f869bdd5d..07e626f5144 100644 --- a/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java +++ b/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java @@ -30,8 +30,8 @@ public void setUp() throws Exception { @Test public void getDisplayNameConvertsLatexToUnicode() throws Exception { GroupNodeViewModel viewModel = getViewModelForGroup( - new WordKeywordGroup("\beta", GroupHierarchyType.INDEPENDENT, "test", "search", true, ',', false)); - assertEquals("baeiabb", viewModel.getDisplayName()); + new WordKeywordGroup("\\beta", GroupHierarchyType.INDEPENDENT, "test", "search", true, ',', false)); + assertEquals("β", viewModel.getDisplayName()); } private GroupNodeViewModel getViewModelForGroup(AbstractGroup group) { From 34a3748b8a2d665bf19c8b7f0d6a7f98c8465878 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Thu, 23 Feb 2017 17:25:54 +0100 Subject: [PATCH 5/5] Update GroupNodeViewModel.java --- src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index a114a28f2cb..61d8f72742f 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -95,6 +95,7 @@ static GroupNodeViewModel getAllEntriesGroup(BibDatabaseContext newDatabase, Sta private Stream createSubgroups(BibDatabaseContext databaseContext, StateManager stateManager, AutomaticGroup automaticGroup, BibEntry entry) { return automaticGroup.createSubgroups(entry).stream() .map(child -> new GroupNodeViewModel(databaseContext, stateManager, child)); + } public SimpleBooleanProperty expandedProperty() { return expandedProperty;