Exemplo n.º 1
0
 public Map<String, String> getNonHumanCategoryIdentifiers() {
   Map<String, String> idMap = new Hashtable<String, String>();
   for (NonHumanCategory r : getNonHumanCategories()) {
     idMap.put(r.getID(), r.getName());
   }
   return idMap;
 }
Exemplo n.º 2
0
 public String getNonHumanCategoryNames() {
   XNode node = new XNode("nonHumanCategoryNames");
   for (NonHumanCategory r : nonHumanCategoryMap.values()) {
     node.addChild("name", r.getName());
   }
   return node.toString();
 }
Exemplo n.º 3
0
 public String getNonHumanCategorySet() {
   XNode node = new XNode("nonHumanCategorySet");
   for (NonHumanCategory category : nonHumanCategoryMap.values()) {
     XNode categoryNode = node.addChild("category");
     categoryNode.addAttribute("name", category.getName());
     for (String subcategory : category.getSubCategoryNames()) {
       categoryNode.addChild("subcategory", subcategory);
     }
   }
   return node.toString();
 }
Exemplo n.º 4
0
  /* saves updates to the values of the currently selected category */
  public boolean saveCategoryChanges(String id) {
    NonHumanCategory category = _orgDataSet.getNonHumanCategory(id);
    if (category == null) {
      _msgPanel.error("Invalid category id: " + id);
      return false;
    }

    // check that any name change is valid
    String name = (String) txtName.getText();
    if ((!name.equals(category.getName())) && _orgDataSet.isKnownNonHumanCategoryName(name)) {
      addDuplicationError("Category");
      return false;
    }

    storeSimpleFieldValues(category);
    _orgDataSet.updateNonHumanCategory(category);
    return true;
  }
Exemplo n.º 5
0
 private void populateSimpleFields(NonHumanCategory category) {
   populateSimpleFields(category.getName(), category.getDescription(), category.getNotes());
 }
Exemplo n.º 6
0
 public int compareTo(NonHumanCategory other) {
   if (other == null) return 1;
   return this.getName().compareTo(other.getName());
 }
Exemplo n.º 7
0
 public NonHumanCategory getNonHumanCategoryByName(String name) {
   for (NonHumanCategory r : nonHumanCategoryMap.values()) {
     if (r.getName().equalsIgnoreCase(name)) return r;
   }
   return null; // no match
 }