Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSMutableArray


    }
  }

  public static EOArrayDataSource dataSourceForObjects(EOEditingContext ec, NSArray list) {
    EOClassDescription cd = null;
    NSMutableArray objects = new NSMutableArray();
    for (Enumeration iter = list.objectEnumerator(); iter.hasMoreElements();) {
      Object o = iter.nextElement();

      EOEnterpriseObject eo = recordForObject(ec, o);
      ec = eo.editingContext();
      cd = eo.classDescription();
      objects.addObject(eo);
    }
    EOArrayDataSource ds = new EOArrayDataSource(cd, ec);
    ds.setArray(objects);
    return ds;
  }
View Full Code Here


     * </span>
     */
    @SuppressWarnings("javadoc")
  public static NSArray optionalConfigurationFiles() {
      NSArray immutableOptionalConfigurationFiles = arrayForKey("er.extensions.ERXProperties.OptionalConfigurationFiles");
      NSMutableArray optionalConfigurationFiles = null;
      if (immutableOptionalConfigurationFiles != null) {
        optionalConfigurationFiles = immutableOptionalConfigurationFiles.mutableClone();
        for (int i = 0; i < optionalConfigurationFiles.count(); i ++) {
          String optionalConfigurationFile = (String)optionalConfigurationFiles.objectAtIndex(i);
          if (!new File(optionalConfigurationFile).exists()) {
              String resourcePropertiesPath = ERXFileUtilities.pathForResourceNamed(optionalConfigurationFile, "app", null);
              if (resourcePropertiesPath != null) {
                  optionalConfigurationFiles.replaceObjectAtIndex(ERXProperties.getActualPath(resourcePropertiesPath), i);
              }
          }
        }
      }
      return optionalConfigurationFiles;
View Full Code Here

        NSNotificationCenter.defaultCenter().addObserver(this, new NSSelector("classDescriptionNeededForEntityName", ERXConstant.NotificationClassArray), EOClassDescription.ClassDescriptionNeededForEntityNameNotification, null);
        NSNotificationCenter.defaultCenter().addObserver(this, new NSSelector("classDescriptionNeededForClass", ERXConstant.NotificationClassArray), EOClassDescription.ClassDescriptionNeededForClassNotification, null);
      }

        public void reset() {
            _registeredModelNames = new NSMutableArray();
            _entitiesForClass = new NSMutableDictionary();
            _classDescriptionForEntity = new NSMutableDictionary();
        }
View Full Code Here

                    EOEntity eoentity = (EOEntity)e.nextElement();
                    String className = eoentity.className();

                    prepareEntityForRegistration(eoentity);

                    NSMutableArray array = (NSMutableArray)_entitiesForClass.objectForKey(className);
                    if(array == null) {
                        array = new NSMutableArray();
                    }
                    if (log.isDebugEnabled())
                        log.debug("Adding entity " +eoentity.name()+ " with class " + eoentity.className());
                    array.addObject(eoentity);
                    _entitiesForClass.setObjectForKey(array, eoentity.className());

                    //HACK ALERT: (ak) We work around classDescriptionForNewInstances() of EOEntity being broken here...
                    registerDescriptionForEntity(eoentity);
                }
View Full Code Here

      throw new UnmarshallException("Could not read javaClass", e);
    }
    if (java_class == null) {
      throw new UnmarshallException("no type hint");
    }
    NSMutableArray al = new NSMutableArray();
    boolean immutableClone = true;
   
    Class klass;
    try {
      klass = Class.forName(java_class);
    } catch (ClassNotFoundException cnfe) {
      throw new UnmarshallException("Could not find class named: " + java_class);
    }

    if (NSMutableArray.class.isAssignableFrom(klass)){
      immutableClone = false;
    } else if (!NSArray.class.isAssignableFrom(klass)) {
      throw new UnmarshallException("not an NSArray");
    }

    JSONArray jsonNSArray;
    try {
      jsonNSArray = jso.getJSONArray("nsarray");
    }
    catch (JSONException e) {
      throw new UnmarshallException("Could not read nsarray: " + e.getMessage(), e);
    }
    if (jsonNSArray == null) {
      throw new UnmarshallException("nsarray missing");
    }
    int i = 0;
    try {
      for (; i < jsonNSArray.length(); i++) {
        Object obj = ser.unmarshall(state, null, jsonNSArray.get(i));
        if (obj != null) {
          al.addObject(obj);
        }
        else {
          al.addObject(NSKeyValueCoding.NullValue);
        }
      }
      NSArray finalArray = al;
      if (immutableClone) {
        finalArray = al.immutableClone();
      }
      state.setSerialized(o, finalArray);
      return finalArray;
    }
    catch (UnmarshallException e) {
View Full Code Here

   
    public ERD2WContainer() {}
   
    public ERD2WContainer(String newName) {
        name = newName;
        keys = new NSMutableArray();
    }
View Full Code Here

        keys = new NSMutableArray();
    }
   
    public ERD2WContainer(String newName, NSArray newKeys) {
        name = newName;
        keys = new NSMutableArray(newKeys);
    }
View Full Code Here

      }
      return indicator;
    }
   
    protected NSDictionary createAjaxOptions() {
      NSMutableArray ajaxOptionsArray = new NSMutableArray();
      ajaxOptionsArray.addObject(new AjaxOption("tokens", AjaxOption.STRING_ARRAY));
      ajaxOptionsArray.addObject(new AjaxOption("frequency", AjaxOption.NUMBER));
      ajaxOptionsArray.addObject(new AjaxOption("minChars", AjaxOption.NUMBER));
      ajaxOptionsArray.addObject(new AjaxOption("indicator", indicator(), AjaxOption.SCRIPT));
      ajaxOptionsArray.addObject(new AjaxOption("updateElement", AjaxOption.SCRIPT));
      ajaxOptionsArray.addObject(new AjaxOption("afterUpdateElement", AjaxOption.SCRIPT));
      ajaxOptionsArray.addObject(new AjaxOption("onShow", AjaxOption.SCRIPT));
      ajaxOptionsArray.addObject(new AjaxOption("fullSearch", AjaxOption.BOOLEAN));
      ajaxOptionsArray.addObject(new AjaxOption("partialSearch", AjaxOption.BOOLEAN));
      ajaxOptionsArray.addObject(new AjaxOption("defaultValue", AjaxOption.STRING));
      ajaxOptionsArray.addObject(new AjaxOption("select", AjaxOption.STRING));
      ajaxOptionsArray.addObject(new AjaxOption("autoSelect", AjaxOption.BOOLEAN));
      ajaxOptionsArray.addObject(new AjaxOption("choices", AjaxOption.NUMBER));
      ajaxOptionsArray.addObject(new AjaxOption("partialChars", AjaxOption.NUMBER));
      ajaxOptionsArray.addObject(new AjaxOption("ignoreCase", AjaxOption.BOOLEAN));
      ajaxOptionsArray.addObject(new AjaxOption("activateOnFocus", AjaxOption.BOOLEAN));
      NSMutableDictionary options = AjaxOption.createAjaxOptionsDictionary(ajaxOptionsArray, this);
      return options;
    }
View Full Code Here

   
 
  @SuppressWarnings({"rawtypes","unchecked"})
  public NSMutableDictionary createAjaxOptions(WOComponent component) {
 
    NSMutableArray ajaxOptionsArray = new NSMutableArray();
    ajaxOptionsArray.addObject(new AjaxOption("observeFieldFrequency", AjaxOption.NUMBER));
    ajaxOptionsArray.addObject(new AjaxOption("observeDelay", AjaxOption.NUMBER));
    ajaxOptionsArray.addObject(new AjaxOption("onCancel", AjaxOption.FUNCTION));
    ajaxOptionsArray.addObject(new AjaxOption("onComplete", AjaxOption.FUNCTION));
    ajaxOptionsArray.addObject(new AjaxOption("onException", AjaxOption.FUNCTION));
    ajaxOptionsArray.addObject(new AjaxOption("onFailure", AjaxOption.FUNCTION));
    ajaxOptionsArray.addObject(new AjaxOption("onRequest", AjaxOption.FUNCTION));
    ajaxOptionsArray.addObject(new AjaxOption("onSuccess", AjaxOption.FUNCTION_2));
    ajaxOptionsArray.addObject(new AjaxOption("async", AjaxOption.BOOLEAN));
    ajaxOptionsArray.addObject(new AjaxOption("evalScripts", AjaxOption.BOOLEAN));
    ajaxOptionsArray.addObject(new AjaxOption("useSpinner", AjaxOption.BOOLEAN));
    ajaxOptionsArray.addObject(new AjaxOption("spinnerTarget", AjaxOption.STRING));
    ajaxOptionsArray.addObject(new AjaxOption("spinnerOptions", AjaxOption.DICTIONARY));

    NSMutableDictionary options = AjaxOption.createAjaxOptionsDictionary(ajaxOptionsArray, component, associations());
    return options;

  }
View Full Code Here

    public NSArray branchChoicesForContext(D2WContext context) {
        NSArray choices = (NSArray)context.valueForKey(BRANCH_CHOICES);
        if (choices == null) {
            choices = defaultBranchChoices(context);
        } else {
          NSMutableArray translatedChoices = new NSMutableArray();
          for (Iterator iter = choices.iterator(); iter.hasNext();) {
            Object o = iter.next();
        String method = null;
        String label = null;
             NSMutableDictionary entry = new NSMutableDictionary();
            if (o instanceof NSDictionary) {
              entry.addEntriesFromDictionary((NSDictionary) o);
              method = (String) entry.objectForKey(BRANCH_NAME);
              label = (String) entry.objectForKey(BRANCH_LABEL);
            } else if (o instanceof String) {
                    method = (String) o;
                    entry.setObjectForKey(method, BRANCH_NAME);
                }
                if (label == null) {
              label = ERXLocalizer.currentLocalizer().localizedDisplayNameForKey(BRANCH_PREFIX, method);
               } else if(label.startsWith(BRANCH_PREFIX + ".")){
                 String localizerKey = label;
              String localized = ERXLocalizer.currentLocalizer().localizedStringForKey(label);
              if(localized == null) {
                label = ERXLocalizer.currentLocalizer().localizedDisplayNameForKey(BRANCH_PREFIX, method);
                  ERXLocalizer.currentLocalizer().takeValueForKey(label, localizerKey);
                } else {
                  label = localized;
              }
               } else {
                 // assume it's a user-provided value. If we have an entry in the localizer, use it
                 // otherwise just return it.
              label = ERXLocalizer.currentLocalizer().localizedStringForKeyWithDefault(label);
            }
            entry.setObjectForKey(label, BRANCH_LABEL);
            entry.setObjectForKey(method +  "Action", BRANCH_BUTTON_ID);
            translatedChoices.addObject(entry);
          }
          choices = translatedChoices;
        }
        return choices;
    }
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSMutableArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.