use of org.jabref.model.groups.AllEntriesGroup in project jabref by JabRef.
the class ImportInspectionDialog method insertNodes.
private void insertNodes(JMenu menu, GroupTreeNode node) {
final AbstractAction action = getAction(node);
if (node.getNumberOfChildren() == 0) {
menu.add(action);
if (action.isEnabled()) {
menu.setEnabled(true);
}
return;
}
JMenu submenu;
if (node.getGroup() instanceof AllEntriesGroup) {
for (GroupTreeNode child : node.getChildren()) {
insertNodes(menu, child);
}
} else {
submenu = new JMenu('[' + node.getName() + ']');
// setEnabled(true) is done above/below if at least one menu
// entry (item or submenu) is enabled
submenu.setEnabled(action.isEnabled());
submenu.add(action);
submenu.add(new JPopupMenu.Separator());
for (GroupTreeNode child : node.getChildren()) {
insertNodes(submenu, child);
}
menu.add(submenu);
if (submenu.isEnabled()) {
menu.setEnabled(true);
}
}
}
use of org.jabref.model.groups.AllEntriesGroup in project jabref by JabRef.
the class DefaultGroupsFactory method getAllEntriesGroup.
public static AllEntriesGroup getAllEntriesGroup() {
AllEntriesGroup group = new AllEntriesGroup(Localization.lang("All entries"));
group.setIconCode(ALL_ENTRIES_GROUP_DEFAULT_ICON);
return group;
}
use of org.jabref.model.groups.AllEntriesGroup in project jabref by JabRef.
the class BibtexDatabaseWriterTest method writeGroupsAndEncoding.
@Test
public void writeGroupsAndEncoding() throws Exception {
SavePreferences preferences = new SavePreferences().withEncoding(Charsets.US_ASCII);
GroupTreeNode groupRoot = GroupTreeNode.fromGroup(new AllEntriesGroup(""));
groupRoot.addChild(GroupTreeNode.fromGroup(new ExplicitGroup("test", GroupHierarchyType.INCLUDING, ',')));
metaData.setGroups(groupRoot);
StringSaveSession session = databaseWriter.savePartOfDatabase(bibtexContext, Collections.emptyList(), preferences);
// @formatter:off
assertEquals("% Encoding: US-ASCII" + OS.NEWLINE + OS.NEWLINE + "@Comment{jabref-meta: grouping:" + OS.NEWLINE + "0 AllEntriesGroup:;" + OS.NEWLINE + "1 StaticGroup:test\\;2\\;1\\;\\;\\;\\;;" + OS.NEWLINE + "}" + OS.NEWLINE, session.getStringValue());
// @formatter:on
}
use of org.jabref.model.groups.AllEntriesGroup in project jabref by JabRef.
the class GroupSerializerTest method serializeSingleAllEntriesGroup.
@Test
public void serializeSingleAllEntriesGroup() {
AllEntriesGroup group = new AllEntriesGroup("");
List<String> serialization = groupSerializer.serializeTree(GroupTreeNode.fromGroup(group));
assertEquals(Collections.singletonList("0 AllEntriesGroup:"), serialization);
}
Aggregations