Search in sources :

Example 16 with NSMutableArray

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

the class ERXWOBrowser method _slowTakeValuesFromRequest.

private void _slowTakeValuesFromRequest(WORequest worequest, WOContext wocontext) {
    WOComponent wocomponent = wocontext.component();
    if (_selections != null && !isDisabledInContext(wocontext) && wocontext.wasFormSubmitted()) {
        String s = nameInContext(wocontext, wocomponent);
        NSArray nsarray = worequest.formValuesForKey(s);
        int i = nsarray != null ? nsarray.count() : 0;
        int size = 0;
        NSMutableArray nsmutablearray = new NSMutableArray(i);
        List vector = null;
        if (i != 0) {
            NSArray nsarray1 = null;
            List vector1 = null;
            Object list = _list.valueInComponent(wocomponent);
            if (list != null) {
                if (list instanceof NSArray) {
                    nsarray1 = (NSArray) list;
                    size = nsarray1.count();
                } else if (list instanceof List) {
                    vector1 = (List) list;
                    nsmutablearray = null;
                    vector = new ArrayList();
                    size = vector1.size();
                } else {
                    throw new IllegalArgumentException("<" + getClass().getName() + "> Evaluating 'list' binding returned a " + list.getClass().getName() + " when it should return either a com.webobjects.foundation.NSArray, or a java.lang.Vector .");
                }
            }
            boolean flag = _multiple != null ? _multiple.booleanValueInComponent(wocomponent) : false;
            for (int k = 0; k < size; k++) {
                Object obj1 = nsarray1 == null ? vector1.get(k) : nsarray1.objectAtIndex(k);
                _item.setValue(obj1, wocomponent);
                Object obj2 = _value.valueInComponent(wocomponent);
                if (obj2 != null) {
                    if (!nsarray.containsObject(obj2.toString())) {
                        continue;
                    }
                    if (nsarray1 != null) {
                        nsmutablearray.addObject(obj1);
                    } else {
                        vector.add(obj1);
                    }
                    if (!flag) {
                        break;
                    }
                } else {
                    log.debug("{} 'value' evaluated to null in component {}.\nUnable to select item {}", this, wocomponent, obj1);
                }
            }
        }
        Object newValue = (nsmutablearray != null ? nsmutablearray : vector);
        setSelectedValue(newValue, wocomponent);
    }
}
Also used : NSArray(com.webobjects.foundation.NSArray) WOComponent(com.webobjects.appserver.WOComponent) NSMutableArray(com.webobjects.foundation.NSMutableArray) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 17 with NSMutableArray

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

the class ERXLog4JConfiguration method classForAppenderRow.

public String classForAppenderRow() {
    NSMutableArray array = new NSMutableArray();
    Level level = currentAppenderLevel().level();
    if (level != null) {
        array.addObject(level);
    }
    if (rowIndex % 2 == 0) {
        array.addObject("alt");
    }
    return array.componentsJoinedByString(" ");
}
Also used : NSMutableArray(com.webobjects.foundation.NSMutableArray) Level(org.apache.log4j.Level)

Example 18 with NSMutableArray

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

the class ERXLog4JConfiguration method loggers.

/**
 * Gets all of the configured {@link Logger loggers} that pass the filters for logger name and level.
 * @return the loggers
 */
public NSArray loggers() {
    NSMutableArray result = new NSMutableArray();
    for (Enumeration e = allLoggers().objectEnumerator(); e.hasMoreElements(); ) {
        Logger log = (Logger) e.nextElement();
        while (log != null) {
            addLogger(log, result);
            log = (Logger) log.getParent();
        }
    }
    return result;
}
Also used : Enumeration(java.util.Enumeration) NSMutableArray(com.webobjects.foundation.NSMutableArray) Logger(org.apache.log4j.Logger)

Example 19 with NSMutableArray

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

the class ERXLog4JConfiguration method allLoggers.

private NSArray allLoggers() {
    NSMutableArray result = new NSMutableArray();
    // Float the root logger to the top.
    Logger rootLogger = LogManager.getRootLogger();
    addLogger(rootLogger, result);
    NSMutableArray otherLoggers = new NSMutableArray();
    for (Enumeration e = LogManager.getCurrentLoggers(); e.hasMoreElements(); ) {
        Logger log = (Logger) e.nextElement();
        while (log != null) {
            if (log != rootLogger) {
                otherLoggers.addObject(log);
            }
            log = (Logger) log.getParent();
        }
    }
    Collections.sort(otherLoggers, Comparator.comparing(Logger::getName));
    result.addObjectsFromArray(otherLoggers);
    return result;
}
Also used : Enumeration(java.util.Enumeration) NSMutableArray(com.webobjects.foundation.NSMutableArray) Logger(org.apache.log4j.Logger)

Example 20 with NSMutableArray

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

the class ERXLog4JConfiguration method classForLoggerRow.

public String classForLoggerRow() {
    NSMutableArray array = new NSMutableArray();
    Level level = logger().getLevel();
    if (level != null) {
        array.addObject(level.toString().toLowerCase());
    }
    if (rowIndex % 2 == 0) {
        array.addObject("alt");
    }
    return array.componentsJoinedByString(" ");
}
Also used : NSMutableArray(com.webobjects.foundation.NSMutableArray) Level(org.apache.log4j.Level)

Aggregations

NSMutableArray (com.webobjects.foundation.NSMutableArray)35 NSArray (com.webobjects.foundation.NSArray)13 Enumeration (java.util.Enumeration)8 NSMutableDictionary (com.webobjects.foundation.NSMutableDictionary)6 WOComponent (com.webobjects.appserver.WOComponent)4 WOElement (com.webobjects.appserver.WOElement)3 WODynamicGroup (com.webobjects.appserver._private.WODynamicGroup)3 WOHTMLBareString (com.webobjects.appserver._private.WOHTMLBareString)3 NSBundle (com.webobjects.foundation.NSBundle)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 WOComponentReference (com.webobjects.appserver._private.WOComponentReference)2 NSComparator (com.webobjects.foundation.NSComparator)2 ERXLocalizer (er.extensions.localization.ERXLocalizer)2 File (java.io.File)2 Level (org.apache.log4j.Level)2 Logger (org.apache.log4j.Logger)2 WOActionResults (com.webobjects.appserver.WOActionResults)1 WOContext (com.webobjects.appserver.WOContext)1 WOEvent (com.webobjects.appserver.WOEvent)1