Example #1
0
 public WOComponent create() {
   //		searchMessage = null;
   //		canCreate = false;
   selection = null;
   setValueForBinding(selection, "selection");
   PersonLink onEdit = Person.Utility.create(ec, entity(), searchString);
   WOComponent returnPage = context().page();
   WOComponent popup = null;
   //		try {
   //			popup = pageWithName("PersonInspector");
   //		} catch (Exception e) {
   popup = pageWithName("SelectorPopup");
   //		}
   if (returnPage instanceof SelectorPopup) {
     SelectorPopup sp = (SelectorPopup) returnPage;
     popup.takeValueForKey(sp.returnPage, "returnPage");
     popup.takeValueForKey(sp.resultPath, "resultPath");
     popup.takeValueForKey(sp.resultGetter, "resultGetter");
     popup.reset();
   } else {
     popup.takeValueForKey(returnPage, "returnPage");
   }
   if (popup instanceof SelectorPopup) {
     NSDictionary dict =
         (NSDictionary) session().valueForKeyPath("strings.RujelBase_Base.newPerson");
     popup.takeValueForKey(onEdit.person(), "value");
     popup.takeValueForKey(dict, "dict");
     //		} else {
     //			popup.takeValueForKey(onEdit, "personLink");
   }
   return popup;
 }
Example #2
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;
 }
Example #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");
  }
Example #4
0
 public String itemFullName() {
   if ((firstNameDisplay > 1) && (secondNameDisplay > 1)) return null;
   else return Person.Utility.fullName(item, true, 2, 2, 2);
 }
Example #5
0
 public String itemName() {
   return Person.Utility.composeName(item, firstNameDisplay, secondNameDisplay);
 }