Ejemplo n.º 1
0
  public void appendToResponse(WOResponse aResponse, WOContext aContext) {
    try {
      Number b = (Number) valueForBinding("firstNameDisplay");
      if (b != null) firstNameDisplay = b.intValue();
      else firstNameDisplay = 2;

      b = (Number) valueForBinding("secondNameDisplay");
      if (b != null) secondNameDisplay = b.intValue();
      else secondNameDisplay = 2;

    } catch (ClassCastException cex) {
      throw new IllegalArgumentException("NameDisplay bindings should be integer");
    }
    String request = (String) valueForBinding("searchRequest");
    if (request != null) {
      performSearchRequest(request);
    } else {
      selection =
          (PersonLink)
              EOUtilities.localInstanceOfObject(
                  ec, (EOEnterpriseObject) valueForBinding("selection"));
      //			syncSelection();
    }
    if (selection == null && Various.boolForObject(valueForBinding("showPopup"))) {
      selection = defaultSelectionValue();
      setValueForBinding(selection, "selection");
    }
    super.appendToResponse(aResponse, aContext);
    found = null;
    //		searchMessage = null;
  }
Ejemplo n.º 2
0
 public String act() {
   if (Various.boolForObject(valueForBinding("useAjaxPost"))) {
     String href = context().componentActionURL();
     String result = "ajaxPopupAction('" + href + "');";
     return result;
   }
   return (String) session().valueForKey("tryLoad");
 }
Ejemplo n.º 3
0
 public void takeValuesFromRequest(WORequest aRequest, WOContext aContext) {
   super.takeValuesFromRequest(aRequest, aContext);
   if (!Various.boolForObject(valueForBinding("showPopup"))) {
     selection =
         (PersonLink)
             EOUtilities.localInstanceOfObject(
                 ec, (EOEnterpriseObject) valueForBinding("selection"));
     //			syncSelection();
   }
 }
Ejemplo n.º 4
0
 public String onChange() {
   StringBuffer buf = new StringBuffer("if(this.selectedIndex==0){");
   /*String message = (String)strings.valueForKeyPath("specific.searchMessage");
   buf.append("q=prompt('").append(message);
   buf.append("');if(q==null)return false;else form.elements[0].value=q;}");*/
   buf.append("document.getElementById('searchArea').style.display='block';}else{");
   if (Various.boolForObject(valueForBinding("useAjaxPost"))) buf.append("ajaxPost(this.form);");
   else buf.append("form.submit();");
   buf.append('}');
   return buf.toString();
 }
Ejemplo n.º 5
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";
    }
  }
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 Boolean canEdit() {
   if (Various.boolForObject(valueForBinding("noEdit"))) return Boolean.FALSE;
   return (Boolean)
       session().valueForKeyPath("readAccess.edit." + ((item == null) ? entity() : "item"));
 }
Ejemplo n.º 8
0
 public String onSubmit() {
   if (Various.boolForObject(valueForBinding("useAjaxPost"))) return "return ajaxPost(this);";
   return "return tryLoad(true);";
 }