Esempio n. 1
0
 void show(Root root) {
   _target = root;
   _hostname.setText(root.getRegistryInfo().hostname);
   _applications.setSortedMap(root.getApplicationMap());
   _objects.setObjects(root.getObjects());
   _adapters.setAdapters(root.getAdapters());
 }
Esempio n. 2
0
 /** {@inheritDoc} */
 @Override
 public GedObject find(final GedObject owner, final String str) {
   if (!(owner instanceof Root)) {
     return null;
   }
   final Root root = (Root) owner;
   return root.getObjects().get(str);
 }
Esempio n. 3
0
 /** {@inheritDoc} */
 @Override
 public Collection<String> findSurnameInitialLetters(final GedObject owner) {
   if (!(owner instanceof Root)) {
     return null;
   }
   final Root root = (Root) owner;
   final Map<String, GedObject> objectMap = root.getObjects();
   final Collection<GedObject> objects = objectMap.values();
   final Set<String> matches = new TreeSet<>();
   for (final GedObject object : objects) {
     if (object instanceof Person) {
       final Person person = (Person) object;
       final String firstLetter = person.getSurname().substring(0, 1);
       matches.add(firstLetter);
     }
   }
   return matches;
 }
Esempio n. 4
0
 /** {@inheritDoc} */
 @Override
 public Collection<String> findBySurnamesBeginWith(
     final GedObject owner, final String beginsWith) {
   if (!(owner instanceof Root)) {
     return null;
   }
   final Root root = (Root) owner;
   final Map<String, GedObject> objectMap = root.getObjects();
   final Collection<GedObject> objects = objectMap.values();
   final Set<String> matches = new TreeSet<>();
   for (final GedObject object : objects) {
     if (object instanceof Person) {
       final Person person = (Person) object;
       final String personSurname = person.getSurname();
       if (personSurname.startsWith(beginsWith)) {
         matches.add(personSurname);
       }
     }
   }
   return matches;
 }
Esempio n. 5
0
  /** {@inheritDoc} */
  @Override
  public Collection<Person> findBySurname(final GedObject owner, final String surname) {
    if (!(owner instanceof Root)) {
      return null;
    }
    final Root root = (Root) owner;
    final Map<String, GedObject> objectMap = root.getObjects();
    final Collection<GedObject> objects = objectMap.values();
    final List<Person> matches = new ArrayList<>();
    for (final GedObject object : objects) {
      if (object instanceof Person) {
        final Person person = (Person) object;
        final String personSurname = person.getSurname();
        if (personSurname.equals(surname)) {
          matches.add((Person) object);
        }
      }
    }

    Collections.sort(matches, new PersonComparator());

    return matches;
  }