use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class ERXWOBrowser method _fastTakeValuesFromRequest.
private void _fastTakeValuesFromRequest(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;
NSMutableArray nsmutablearray = new NSMutableArray(i);
List vector = null;
if (i != 0) {
NSArray nsarray1 = null;
List vector1 = null;
if (_list != null) {
Object obj = _list.valueInComponent(wocomponent);
if (obj != null) {
if (obj instanceof NSArray) {
nsarray1 = (NSArray) obj;
} else if (obj instanceof List) {
vector1 = (List) obj;
nsmutablearray = null;
vector = new ArrayList(i);
} else {
throw new IllegalArgumentException("<" + getClass().getName() + "> Evaluating 'list' binding returned a " + obj.getClass().getName() + " when it should return either a com.webobjects.foundation.NSArray, or a java.lang.Vector .");
}
}
}
for (int j = 0; j < i; j++) {
String s1 = (String) nsarray.objectAtIndex(j);
int k = Integer.parseInt(s1);
if (nsarray1 != null) {
Object obj2 = nsarray1.objectAtIndex(k);
nsmutablearray.addObject(obj2);
} else {
Object obj3 = vector1.get(k);
vector.add(obj3);
}
}
}
Object newValue = (nsmutablearray != null ? nsmutablearray : vector);
setSelectedValue(newValue, wocomponent);
}
}
use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class ERXWOBrowser method appendAttributesToResponse.
@Override
public void appendAttributesToResponse(WOResponse woresponse, WOContext wocontext) {
super.appendAttributesToResponse(woresponse, wocontext);
Object obj = null;
WOComponent wocomponent = wocontext.component();
if (_size != null) {
obj = _size.valueInComponent(wocomponent);
}
if (_size == null || obj == null || Integer.parseInt(obj.toString()) == 1) {
obj = WOShared.unsignedIntString(5);
}
woresponse._appendTagAttributeAndValue("size", obj.toString(), false);
if (_multiple != null && _multiple.booleanValueInComponent(wocomponent)) {
woresponse.appendContentCharacter(' ');
woresponse._appendContentAsciiString("multiple=\"multiple\"");
}
}
use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class ERXWOForm method appendAttributesToResponse.
@Override
public void appendAttributesToResponse(WOResponse response, WOContext context) {
String formName = _formName(context);
if (formName != null) {
response._appendTagAttributeAndValue(ERXWOForm.useIdInsteadOfNameTag ? "id" : "name", formName, false);
}
String enctype = _enctype(context);
if (enctype != null) {
_setEnctype(enctype);
response._appendTagAttributeAndValue("enctype", enctype, false);
}
boolean secure = secureInContext(context);
Object hrefObject = null;
WOComponent wocomponent = context.component();
super.appendAttributesToResponse(response, context);
boolean generatingCompleteURLs = context.doesGenerateCompleteURLs();
boolean requestIsSecure = context.secureMode();
boolean switchToCompleteURLs = secure ^ requestIsSecure;
if (switchToCompleteURLs && !generatingCompleteURLs) {
context.generateCompleteURLs();
}
try {
if (_href != null) {
hrefObject = _href.valueInComponent(wocomponent);
// even calling it this way, anyway.
if (secure && hrefObject != null) {
hrefObject = hrefObject.toString().replaceFirst("http://", "https://");
}
} else if (_directActionName != null || _actionClass != null) {
hrefObject = cgiAction(response, context, secure);
} else {
hrefObject = context.componentActionURL(WOApplication.application().componentRequestHandlerKey(), secure);
}
if (hrefObject != null) {
String href = hrefObject.toString();
Object fragmentIdentifier = (_fragmentIdentifier != null ? _fragmentIdentifier.valueInComponent(context.component()) : null);
if (fragmentIdentifier != null) {
href = href + "#" + fragmentIdentifier;
}
response._appendTagAttributeAndValue("action", href, false);
} else {
log.error("<WOForm> : action attribute evaluates to null");
}
} finally {
if (switchToCompleteURLs && !generatingCompleteURLs) {
context.generateRelativeURLs();
}
}
}
use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class ERXWORepetition method appendToResponse.
@Override
public void appendToResponse(WOResponse woresponse, WOContext wocontext) {
WOComponent wocomponent = wocontext.component();
Context context = createContext(wocomponent);
int count = _count(context, wocomponent);
boolean checkHashCodes = checkHashCodes(wocomponent);
log.debug("appendToResponse: {}", wocontext.elementID());
for (int index = 0; index < count; index++) {
_prepareForIterationWithIndex(context, index, wocontext, wocomponent, checkHashCodes);
appendChildrenToResponse(woresponse, wocontext);
}
if (count > 0) {
_cleanupAfterIteration(count, wocontext, wocomponent);
}
}
use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.
the class ERXWORepetition method takeValuesFromRequest.
@Override
public void takeValuesFromRequest(WORequest worequest, WOContext wocontext) {
WOComponent wocomponent = wocontext.component();
Context context = createContext(wocomponent);
int count = _count(context, wocomponent);
boolean checkHashCodes = checkHashCodes(wocomponent);
if (log.isDebugEnabled()) {
log.debug("takeValuesFromRequest: {} - {}", wocontext.elementID(), wocontext.request().formValueKeys());
}
for (int index = 0; index < count; index++) {
_prepareForIterationWithIndex(context, index, wocontext, wocomponent, checkHashCodes);
super.takeValuesFromRequest(worequest, wocontext);
}
if (count > 0) {
_cleanupAfterIteration(count, wocontext, wocomponent);
}
}
Aggregations