Ejemplo n.º 1
0
 public boolean listIsEmpty() {
   NSArray list = found;
   if (list != null && list.count() > 0) return false;
   list = (NSArray) valueForBinding("forcedList");
   if (list != null && list.count() > 0) return false;
   list = personList();
   if (list != null && list.count() > 0) return false;
   return true;
 }
Ejemplo n.º 2
0
 public WOActionResults submit() {
   if (selection == null) {
     search();
     if (found != null && found.count() > 0) {
       selection = (PersonLink) found.objectAtIndex(0);
     } else {
       selection = defaultSelectionValue();
     }
   }
   setValueForBinding(selection, "selection");
   return (WOActionResults) valueForBinding("selectAction");
 }
Ejemplo n.º 3
0
 protected PersonLink defaultSelectionValue() {
   NSArray list = (NSArray) valueForBinding("forcedList");
   if (list != null && list.count() > 0) {
     return (PersonLink)
         EOUtilities.localInstanceOfObject(ec, (EOEnterpriseObject) list.objectAtIndex(0));
   }
   list = (NSArray) session().valueForKey("personList");
   if (list != null && list.count() > 0) {
     Enumeration enu = list.objectEnumerator();
     while (enu.hasMoreElements()) {
       EOEnterpriseObject pers = (EOEnterpriseObject) enu.nextElement();
       if (entity().equals(pers.entityName())) {
         return (PersonLink) pers;
       }
     }
   }
   return null;
 }
Ejemplo n.º 4
0
 public NSArray personList() {
   NSArray forcedList = (NSArray) valueForBinding("forcedList");
   NSMutableArray result =
       (forcedList == null)
           ? new NSMutableArray()
           : EOUtilities.localInstancesOfObjects(ec, forcedList).mutableClone();
   NSArray personList = (NSArray) session().valueForKey("personList");
   if (personList != null && personList.count() > 0) {
     Enumeration enu = personList.objectEnumerator();
     while (enu.hasMoreElements()) {
       EOEnterpriseObject pers = (EOEnterpriseObject) enu.nextElement();
       if (!result.contains(pers)
           && (entity().equals(pers.entityName()) || pers.entityName().equals(alterEntity())))
         result.addObject(pers);
     }
   }
   return result;
 }
Ejemplo n.º 5
0
  protected void performSearchRequest(String request) {
    searchString = request;
    canCreate = false;
    search();
    while (found == null || found.count() == 0) {
      searchString = searchString.substring(0, searchString.length() - 1);
      if (searchString.length() < 2) {
        searchString = request;
        setValueForBinding(null, "searchRequest");
        return;
      }
      search();
    }
    selection = (PersonLink) found.objectAtIndex(0);
    setValueForBinding(selection, "selection");

    setValueForBinding(Person.Utility.fullName(selection, true, 2, 2, 2), "searchRequest");
    valueForBinding("selectAction");
  }
Ejemplo n.º 6
0
 public void search() {
   try {
     found = Person.Utility.search(ec, entity(), searchString);
     if ((found == null || found.count() == 0) && alterEntity() != null)
       found = Person.Utility.search(ec, alterEntity(), searchString);
   } catch (Exception e) {
     searchMessage = e.getMessage();
     canCreate = false;
     return;
   }
   if (found.count() < 1) {
     searchMessage = (String) session().valueForKeyPath("strings.Strings.messages.nothingFound");
     canCreate = Various.boolForObject(session().valueForKeyPath("readAccess.create." + entity()));
     return;
   }
   NSMutableArray fullList = (NSMutableArray) session().valueForKey("personList");
   NSMutableArray tmp = found.mutableClone();
   tmp.removeObjectsInArray(fullList);
   fullList.addObjectsFromArray(tmp);
   if (fullList.count() > 1) EOSortOrdering.sortArrayUsingKeyOrderArray(fullList, Person.sorter);
   searchMessage = null;
 }
Ejemplo n.º 7
0
  public String style() {
    // Boolean useStyles = (Boolean)valueForBinding("useStyles");
    if (Various.boolForObject(valueForBinding("useStyles"))) return null;
    // (useStyles != null && !useStyles.booleanValue())

    if (selection != null && item.equals(selection.person())) return "selection";
    if (item.sex() == null) return "grey";

    if (found != null && found.containsObject(item)) {
      if (item.sex().booleanValue()) return "foundMale";
      else return "foundFemale";
    } else {
      if (item.sex().booleanValue()) return "male";
      else return "female";
    }
  }