use of org.jabref.model.groups.WordKeywordGroup in project jabref by JabRef.
the class GroupNodeViewModelTest method draggedOnTopOfGroupAddsBeforeIt.
@Test
public void draggedOnTopOfGroupAddsBeforeIt() throws Exception {
GroupNodeViewModel rootViewModel = getViewModelForGroup(new WordKeywordGroup("root", GroupHierarchyType.INCLUDING, "keywords", "A", true, ',', true));
WordKeywordGroup groupA = new WordKeywordGroup("A", GroupHierarchyType.INCLUDING, "keywords", "A", true, ',', true);
WordKeywordGroup groupB = new WordKeywordGroup("B", GroupHierarchyType.INCLUDING, "keywords", "A > B", true, ',', true);
WordKeywordGroup groupC = new WordKeywordGroup("C", GroupHierarchyType.INCLUDING, "keywords", "A > B > B1", true, ',', true);
GroupNodeViewModel groupAViewModel = getViewModelForGroup(rootViewModel.addSubgroup(groupA));
GroupNodeViewModel groupBViewModel = getViewModelForGroup(rootViewModel.addSubgroup(groupB));
GroupNodeViewModel groupCViewModel = getViewModelForGroup(rootViewModel.addSubgroup(groupC));
groupCViewModel.draggedOn(groupBViewModel, DroppingMouseLocation.TOP);
assertEquals(Arrays.asList(groupAViewModel, groupCViewModel, groupBViewModel), rootViewModel.getChildren());
}
use of org.jabref.model.groups.WordKeywordGroup in project jabref by JabRef.
the class GroupNodeViewModelTest method treeOfAutomaticKeywordGroupIsCombined.
@Test
public void treeOfAutomaticKeywordGroupIsCombined() throws Exception {
BibEntry entryOne = new BibEntry().withField("keywords", "A > B > B1, A > C");
BibEntry entryTwo = new BibEntry().withField("keywords", "A > D, E");
BibEntry entryThree = new BibEntry().withField("keywords", "A > B > B2");
databaseContext.getDatabase().insertEntries(entryOne, entryTwo, entryThree);
AutomaticKeywordGroup group = new AutomaticKeywordGroup("Keywords", GroupHierarchyType.INDEPENDENT, "keywords", ',', '>');
GroupNodeViewModel groupViewModel = getViewModelForGroup(group);
WordKeywordGroup expectedGroupA = new WordKeywordGroup("A", GroupHierarchyType.INCLUDING, "keywords", "A", true, ',', true);
WordKeywordGroup expectedGroupB = new WordKeywordGroup("B", GroupHierarchyType.INCLUDING, "keywords", "A > B", true, ',', true);
WordKeywordGroup expectedGroupB1 = new WordKeywordGroup("B1", GroupHierarchyType.INCLUDING, "keywords", "A > B > B1", true, ',', true);
WordKeywordGroup expectedGroupB2 = new WordKeywordGroup("B2", GroupHierarchyType.INCLUDING, "keywords", "A > B > B2", true, ',', true);
WordKeywordGroup expectedGroupC = new WordKeywordGroup("C", GroupHierarchyType.INCLUDING, "keywords", "A > C", true, ',', true);
WordKeywordGroup expectedGroupD = new WordKeywordGroup("D", GroupHierarchyType.INCLUDING, "keywords", "A > D", true, ',', true);
WordKeywordGroup expectedGroupE = new WordKeywordGroup("E", GroupHierarchyType.INCLUDING, "keywords", "E", true, ',', true);
GroupNodeViewModel expectedA = getViewModelForGroup(expectedGroupA);
GroupTreeNode expectedB = expectedA.addSubgroup(expectedGroupB);
expectedB.addSubgroup(expectedGroupB1);
expectedB.addSubgroup(expectedGroupB2);
expectedA.addSubgroup(expectedGroupC);
expectedA.addSubgroup(expectedGroupD);
GroupNodeViewModel expectedE = getViewModelForGroup(expectedGroupE);
ObservableList<GroupNodeViewModel> expected = FXCollections.observableArrayList(expectedA, expectedE);
assertEquals(expected, groupViewModel.getChildren());
}
use of org.jabref.model.groups.WordKeywordGroup in project jabref by JabRef.
the class GroupNodeViewModelTest method getDisplayNameConvertsLatexToUnicode.
@Test
public void getDisplayNameConvertsLatexToUnicode() throws Exception {
GroupNodeViewModel viewModel = getViewModelForGroup(new WordKeywordGroup("\\beta", GroupHierarchyType.INDEPENDENT, "test", "search", true, ',', false));
assertEquals("β", viewModel.getDisplayName());
}
use of org.jabref.model.groups.WordKeywordGroup in project jabref by JabRef.
the class GroupNodeViewModelTest method draggedOnTopOfGroupAddsBeforeItWhenSourceGroupWasBefore.
@Test
public void draggedOnTopOfGroupAddsBeforeItWhenSourceGroupWasBefore() throws Exception {
GroupNodeViewModel rootViewModel = getViewModelForGroup(new WordKeywordGroup("root", GroupHierarchyType.INCLUDING, "keywords", "A", true, ',', true));
WordKeywordGroup groupA = new WordKeywordGroup("A", GroupHierarchyType.INCLUDING, "keywords", "A", true, ',', true);
WordKeywordGroup groupB = new WordKeywordGroup("B", GroupHierarchyType.INCLUDING, "keywords", "A > B", true, ',', true);
WordKeywordGroup groupC = new WordKeywordGroup("C", GroupHierarchyType.INCLUDING, "keywords", "A > B > B1", true, ',', true);
GroupNodeViewModel groupAViewModel = getViewModelForGroup(rootViewModel.addSubgroup(groupA));
GroupNodeViewModel groupBViewModel = getViewModelForGroup(rootViewModel.addSubgroup(groupB));
GroupNodeViewModel groupCViewModel = getViewModelForGroup(rootViewModel.addSubgroup(groupC));
groupAViewModel.draggedOn(groupCViewModel, DroppingMouseLocation.TOP);
assertEquals(Arrays.asList(groupBViewModel, groupAViewModel, groupCViewModel), rootViewModel.getChildren());
}
use of org.jabref.model.groups.WordKeywordGroup in project jabref by JabRef.
the class GroupSerializerTest method serializeSingleSimpleKeywordGroup.
@Test
public void serializeSingleSimpleKeywordGroup() {
WordKeywordGroup group = new WordKeywordGroup("name", GroupHierarchyType.INDEPENDENT, "keywords", "test", false, ',', false);
List<String> serialization = groupSerializer.serializeTree(GroupTreeNode.fromGroup(group));
assertEquals(Collections.singletonList("0 KeywordGroup:name;0;keywords;test;0;0;1;;;;"), serialization);
}
Aggregations