Package net.sf.jabref.groups

Examples of net.sf.jabref.groups.ExplicitGroup


              if (newGroups != null) {

                  // ensure that there is always only one AllEntriesGroup
                  if (newGroups.getGroup() instanceof AllEntriesGroup) {
                      // create a dummy group
                      ExplicitGroup group = new ExplicitGroup("Imported",
                              AbstractGroup.INDEPENDENT); // JZTODO lyrics
                      newGroups.setGroup(group);
                      for (int i = 0; i < appendedEntries.size(); ++i)
                          group.addEntry(appendedEntries.get(i));
                  }

                  // groupsSelector is always created, even when no groups
                  // have been defined. therefore, no check for null is
                  // required here
                  frame.groupSelector.addGroups(newGroups, ce);
                  // for explicit groups, the entries copied to the mother fromDatabase have to
                  // be "reassigned", i.e. the old reference is removed and the reference
                  // to the new fromDatabase is added.
                  GroupTreeNode node;
                  ExplicitGroup group;
                  BibtexEntry entry;
                 
                  for (Enumeration<GroupTreeNode> e = newGroups
          .preorderEnumeration(); e.hasMoreElements();) {
          node = e.nextElement();
          if (!(node.getGroup() instanceof ExplicitGroup))
            continue;
          group = (ExplicitGroup) node.getGroup();
          for (int i = 0; i < originalEntries.size(); ++i) {
            entry = originalEntries.get(i);
            if (group.contains(entry)) {
              group.removeEntry(entry);
              group.addEntry(appendedEntries.get(i));
            }
          }
        }
                  frame.groupSelector.revalidateGroups();
              }
View Full Code Here


                if (typeId.equals(AllEntriesGroup.ID)) {
                    // register the id of the root node:
                    groups.put(rs.getString("groups_id"), rootNode);
                }
                else if (typeId.equals(ExplicitGroup.ID)) {
                    group = new ExplicitGroup(rs.getString("label"),
                            rs.getInt("hierarchical_context"));
                }
                else if (typeId.equals(KeywordGroup.ID)) {
                    System.out.println("Keyw: "+ rs.getBoolean("case_sensitive"));
                    group = new KeywordGroup(rs.getString("label"),
                            Util.unquote(rs.getString("search_field"), '\\'),
                            Util.unquote(rs.getString("search_expression"), '\\'),
                            rs.getBoolean("case_sensitive"), rs.getBoolean("reg_exp"),
                            rs.getInt("hierarchical_context"));
                }
                else if (typeId.equals(SearchGroup.ID)) {
                    System.out.println("Search: "+ rs.getBoolean("case_sensitive"));
                    group = new SearchGroup(rs.getString("label"),
                            Util.unquote(rs.getString("search_expression"), '\\'),
                            rs.getBoolean("case_sensitive"), rs.getBoolean("reg_exp"),
                            rs.getInt("hierarchical_context"));
                }

                if (group != null) {
                    GroupTreeNode node = new GroupTreeNode(group);
                    parentIds.put(node, rs.getString("parent_id"));
                    groups.put(rs.getString("groups_id"), node);
                }
            }
            statement.close();

            // Ok, we have collected a map of all groups and their parent IDs,
            // and another map of all group IDs and their group nodes.
            // Now we need to build the groups tree:
            for (Iterator<GroupTreeNode> i=parentIds.keySet().iterator(); i.hasNext();) {
                GroupTreeNode node = i.next();
                String parentId = parentIds.get(node);
                // Look up the parent:
                GroupTreeNode parent = groups.get(parentId);
                if (parent == null) {
                    // TODO: missing parent
                }
                else {
                    parent.add(node);
                }
            }

            // If we have explicit groups, set up group membership:
            res = processDMLWithResults(conn, "SELECT * FROM entry_group;");
            if (res instanceof Statement) {
                statement = (Statement)res;
                rs = statement.getResultSet();
                while ( rs.next()) {
                    String entryId = rs.getString("entries_id"),
                            groupId = rs.getString("groups_id");
                    GroupTreeNode node = groups.get(groupId);
                    if ((node != null) && (node.getGroup() instanceof ExplicitGroup)) {
                        ExplicitGroup group = (ExplicitGroup)node.getGroup();
                        group.addEntry(entries.get(entryId));
                    } else {
                        // TODO: unable to find explicit group with the given id
                    }
                }
                statement.close();
View Full Code Here

    // if this group contains entries...
    if ( cursor.getGroup() instanceof ExplicitGroup) {

      // build INSERT statement for each entry belonging to this group
      ExplicitGroup grp = (ExplicitGroup)cursor.getGroup();
     
      for (BibtexEntry be : grp.getEntries()){

                // handle DML according to output type
                processDML(out, "INSERT INTO entry_group (entries_id, groups_id) "
               + "VALUES ("
               + "(SELECT entries_id FROM entries WHERE jabref_eid="
View Full Code Here

TOP

Related Classes of net.sf.jabref.groups.ExplicitGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.