Search in sources :

Example 41 with WOComponent

use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.

the class ERXWOTextField method _appendValueAttributeToResponse.

@Override
protected void _appendValueAttributeToResponse(WOResponse woresponse, WOContext wocontext) {
    WOComponent component = wocontext.component();
    Object valueInComponent = _value.valueInComponent(component);
    if (valueInComponent != null) {
        String stringValue = null;
        Format format = null;
        boolean hasFormatter = false;
        if (_formatter != null) {
            format = (Format) _formatter.valueInComponent(component);
        }
        if (format == null) {
            if (_dateFormat != null) {
                String formatString = (String) _dateFormat.valueInComponent(component);
                if (formatString != null) {
                    format = ERXTimestampFormatter.dateFormatterForPattern(formatString);
                }
            } else if (_numberFormat != null) {
                String formatString = (String) _numberFormat.valueInComponent(component);
                if (formatString != null) {
                    format = ERXNumberFormatter.numberFormatterForPattern(formatString);
                }
            }
        } else {
            hasFormatter = true;
        }
        if (format != null) {
            try {
                String formatedValue = format.format(valueInComponent);
                Object reparsedObject = format.parseObject(formatedValue);
                stringValue = format.format(reparsedObject);
            } catch (IllegalArgumentException illegalargumentexception) {
                NSLog._conditionallyLogPrivateException(illegalargumentexception);
                stringValue = null;
            } catch (ParseException parseexception) {
                NSLog._conditionallyLogPrivateException(parseexception);
            }
        }
        if (stringValue == null) {
            stringValue = valueInComponent.toString();
        }
        woresponse._appendTagAttributeAndValue("value", stringValue, true);
    }
    if (isReadonlyInContext(wocontext)) {
        woresponse._appendTagAttributeAndValue("readonly", "readonly", false);
    }
}
Also used : Format(java.text.Format) WOComponent(com.webobjects.appserver.WOComponent) ParseException(java.text.ParseException)

Example 42 with WOComponent

use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.

the class FocusTextField method appendToResponse.

@Override
public void appendToResponse(WOResponse response, WOContext context) {
    AjaxUtils.addScriptResourceInHead(context, response, "prototype.js");
    super.appendToResponse(response, context);
    WOComponent component = context.component();
    boolean focus = (_focus == null || _focus.booleanValueInComponent(component));
    boolean selectAll = (_selectAll != null && _selectAll.booleanValueInComponent(component));
    String id = id(component, context);
    String onEnterScript = (_onEnter != null) ? (String) _onEnter.valueInComponent(component) : null;
    FocusTextField.appendJavascriptToResponse(response, context, id, focus, selectAll, onEnterScript);
}
Also used : WOComponent(com.webobjects.appserver.WOComponent)

Example 43 with WOComponent

use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.

the class FocusTextField method _appendAttributesFromAssociationsToResponse.

@Override
protected void _appendAttributesFromAssociationsToResponse(WOResponse response, WOContext wocontext, NSDictionary nsdictionary) {
    super._appendAttributesFromAssociationsToResponse(response, wocontext, nsdictionary);
    WOComponent component = wocontext.component();
    String onKeyPress = (_onKeyPress != null) ? (String) _onKeyPress.valueInComponent(component) : null;
    String onEnterScript = (_onEnter != null) ? (String) _onEnter.valueInComponent(component) : null;
    String id = id(component, wocontext);
    if (_id == null) {
        response.appendContentString(" id = \"" + id + "\"");
    }
    FocusTextField._appendAttributesFromAssociationsToResponse(response, wocontext, id, onKeyPress, onEnterScript);
}
Also used : WOComponent(com.webobjects.appserver.WOComponent)

Example 44 with WOComponent

use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.

the class AjaxSessionPing method appendToResponse.

/**
 * Appends script to start Ajax.ActivePeriodicalUpdater to the response.
 */
@Override
public void appendToResponse(WOResponse response, WOContext context) {
    super.appendToResponse(response, context);
    WOComponent component = context.component();
    response.appendContentString("<script>var AjaxSessionPinger = new Ajax.ActivePeriodicalUpdater('AjaxSessionPinger', '");
    if (booleanValueForBinding("keepSessionAlive", false, component)) {
        response.appendContentString(context.directActionURLForActionNamed("AjaxSessionPing$Action/pingSessionAndKeepAlive", null, context.secureMode(), false));
    } else {
        response.appendContentString(context.directActionURLForActionNamed("AjaxSessionPing$Action/pingSession", null, context.secureMode(), false));
    }
    response.appendContentString("', ");
    AjaxOptions.appendToResponse(createAjaxOptions(component), response, context);
    response.appendContentString(");</script>");
}
Also used : WOComponent(com.webobjects.appserver.WOComponent)

Example 45 with WOComponent

use of com.webobjects.appserver.WOComponent in project wonder-slim by undur.

the class AjaxSubmitButton method invokeAction.

@Override
public WOActionResults invokeAction(WORequest worequest, WOContext wocontext) {
    WOActionResults result = null;
    WOComponent wocomponent = wocontext.component();
    String nameInContext = nameInContext(wocontext, wocomponent);
    boolean shouldHandleRequest = (!disabledInComponent(wocomponent) && wocontext.wasFormSubmitted()) && ((wocontext.isMultipleSubmitForm() && nameInContext.equals(worequest.formValueForKey(KEY_AJAX_SUBMIT_BUTTON_NAME))) || !wocontext.isMultipleSubmitForm());
    if (shouldHandleRequest) {
        String updateContainerID = AjaxUpdateContainer.updateContainerID(this, wocomponent);
        AjaxUpdateContainer.setUpdateContainerID(worequest, updateContainerID);
        wocontext.setActionInvoked(true);
        result = handleRequest(worequest, wocontext);
        ERXAjaxApplication.enableShouldNotStorePage();
    }
    return result;
}
Also used : WOActionResults(com.webobjects.appserver.WOActionResults) WOComponent(com.webobjects.appserver.WOComponent)

Aggregations

WOComponent (com.webobjects.appserver.WOComponent)68 WOActionResults (com.webobjects.appserver.WOActionResults)11 WOResponse (com.webobjects.appserver.WOResponse)10 WOContext (com.webobjects.appserver.WOContext)8 NSMutableDictionary (com.webobjects.foundation.NSMutableDictionary)8 NSDictionary (com.webobjects.foundation.NSDictionary)7 Format (java.text.Format)5 WOApplication (com.webobjects.appserver.WOApplication)4 WOAssociation (com.webobjects.appserver.WOAssociation)4 NSMutableArray (com.webobjects.foundation.NSMutableArray)4 ERXWOContext (er.extensions.appserver.ERXWOContext)4 ParseException (java.text.ParseException)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 WOElement (com.webobjects.appserver.WOElement)3 WORequest (com.webobjects.appserver.WORequest)3 WODynamicElementCreationException (com.webobjects.appserver._private.WODynamicElementCreationException)3 NSArray (com.webobjects.foundation.NSArray)3 WOSession (com.webobjects.appserver.WOSession)2 ERXMutableURL (er.extensions.foundation.ERXMutableURL)2