Search in sources :

Example 41 with NSArray

use of com.webobjects.foundation.NSArray in project wonder-slim by undur.

the class ERXDeployedBundle method deployedBundleForFrameworkNamed.

public static synchronized WODeployedBundle deployedBundleForFrameworkNamed(String aFrameworkName) {
    WODeployedBundle aBundle = null;
    NSArray bundleArray = TheBundles.allValues();
    int baCount = TheBundles.count();
    NSBundle nsBundle = NSBundle.bundleForName(aFrameworkName);
    if (nsBundle == null)
        nsBundle = NSBundle.bundleWithPath(aFrameworkName);
    if (nsBundle != null) {
        int i = 0;
        do {
            if (i >= baCount)
                break;
            WODeployedBundle aFrameworkBundle = (WODeployedBundle) bundleArray.objectAtIndex(i);
            if (nsBundle.equals(aFrameworkBundle.nsBundle())) {
                aBundle = aFrameworkBundle;
                WODeployedBundle dBundle = aBundle.projectBundle();
                if (dBundle != null)
                    aBundle = dBundle;
                break;
            }
            i++;
        } while (true);
    }
    return aBundle;
}
Also used : WODeployedBundle(com.webobjects.appserver._private.WODeployedBundle) NSBundle(com.webobjects.foundation.NSBundle) NSArray(com.webobjects.foundation.NSArray)

Example 42 with NSArray

use of com.webobjects.foundation.NSArray in project wonder-slim by undur.

the class WXOutlineEntry method isExpanded.

public boolean isExpanded() {
    Object currentItem = valueForBinding("item");
    NSArray selectionPath = (NSArray) _WOJExtensionsUtil.valueForBindingOrNull("selectionPath", this);
    return (_nestingLevel < selectionPath.count()) && selectionPath.objectAtIndex(_nestingLevel).equals(currentItem);
}
Also used : NSArray(com.webobjects.foundation.NSArray)

Example 43 with NSArray

use of com.webobjects.foundation.NSArray in project wonder-slim by undur.

the class WOEventDisplayPage method topmostDurationValue.

public long topmostDurationValue() {
    NSArray roots;
    roots = rootEventList();
    if (roots == null || (roots.count() == 0))
        return 0;
    else
        return durationOfEvent((EOEvent) roots.objectAtIndex(0));
}
Also used : EOEvent(com.webobjects.eocontrol.EOEvent) NSArray(com.webobjects.foundation.NSArray)

Example 44 with NSArray

use of com.webobjects.foundation.NSArray in project wonder-slim by undur.

the class WOEventDisplayPage method durationOfEvent.

public long durationOfEvent(EOEvent e) {
    int i, n;
    long sum;
    NSArray kids;
    // be displayed, even if they may have a duration.
    if (_displayMode != 4) {
        sum = e.duration();
        return sum;
    }
    // if an event has no kids, but we are still here, it means that it is
    // an association event (because otherwise it would be filtered out).
    kids = childrenForEvent(e);
    if (kids == null) {
        kids = NSArray.EmptyArray;
    }
    n = kids.count();
    if (n != 0) {
        for (i = 0, sum = 0; i < n; i++) {
            sum += ((EOEvent) kids.objectAtIndex(i)).duration();
        }
    } else {
        sum = e.duration();
    }
    return sum;
}
Also used : NSArray(com.webobjects.foundation.NSArray)

Example 45 with NSArray

use of com.webobjects.foundation.NSArray in project wonder-slim by undur.

the class ERXSimpleTemplateParser method keysInTemplate.

/**
 * Calculates the set of keys used in a given template
 * for a given delimiter.
 *
 * @param template to check for keys
 * @param delimiter for finding keys
 * @return array of keys
 */
public NSArray keysInTemplate(String template, String delimiter) {
    NSMutableSet keys = new NSMutableSet();
    if (delimiter == null) {
        delimiter = DEFAULT_DELIMITER;
    }
    NSArray components = NSArray.componentsSeparatedByString(template, delimiter);
    if (!isLoggingDisabled) {
        log.debug("Components: {}", components);
    }
    // if the template starts with delim, the first component will be a zero-length string
    boolean deriveElement = false;
    for (Enumeration e = components.objectEnumerator(); e.hasMoreElements(); ) {
        String element = (String) e.nextElement();
        if (deriveElement) {
            if (element.length() == 0) {
                throw new IllegalArgumentException("\"\" is not a valid keypath");
            }
            keys.addObject(element);
            deriveElement = false;
        } else {
            deriveElement = true;
        }
    }
    return keys.allObjects();
}
Also used : Enumeration(java.util.Enumeration) NSMutableSet(com.webobjects.foundation.NSMutableSet) NSArray(com.webobjects.foundation.NSArray)

Aggregations

NSArray (com.webobjects.foundation.NSArray)53 Enumeration (java.util.Enumeration)17 NSMutableArray (com.webobjects.foundation.NSMutableArray)13 NSBundle (com.webobjects.foundation.NSBundle)5 NSMutableDictionary (com.webobjects.foundation.NSMutableDictionary)5 File (java.io.File)4 List (java.util.List)4 WOAssociation (com.webobjects.appserver.WOAssociation)3 WOComponent (com.webobjects.appserver.WOComponent)3 NSDictionary (com.webobjects.foundation.NSDictionary)3 IOException (java.io.IOException)3 URL (java.net.URL)3 ArrayList (java.util.ArrayList)3 WOElement (com.webobjects.appserver.WOElement)2 WOResponse (com.webobjects.appserver.WOResponse)2 WOConstantValueAssociation (com.webobjects.appserver._private.WOConstantValueAssociation)2 EOEvent (com.webobjects.eocontrol.EOEvent)2 EOSortOrdering (com.webobjects.eocontrol.EOSortOrdering)2 NSForwardException (com.webobjects.foundation.NSForwardException)2 NSKeyValueCoding (com.webobjects.foundation.NSKeyValueCoding)2