예제 #1
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");
 }
예제 #2
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;
 }
예제 #3
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");
  }