Package org.apache.empire.struts2.actionsupport

Examples of org.apache.empire.struts2.actionsupport.ActionError


            return;
        }
       
        // Render error list
        HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
        HtmlTag list = w.startTag(dic.ErrorListTag());
        addStandardAttributes(list, dic.ErrorListClass());
        list.beginBody();
   
        // Are there field errors to render?
        if (hasFieldErrors)
        {   // Render all field errors
            Collection<ErrorInfo> errors = fieldErrors.values();
            String fieldErrClass = str(fieldErrorClass, dic.ErrorItemEntryClass());
            for (ErrorInfo e : errors)
            {
                String msg = provider.getLocalizedErrorMessage(e);
                renderError(w, fieldErrClass, msg);
            }
        }
       
        // Render last action error
        if (hasActionError)
        {   // Render action error
            String actionErrClass = str(actionErrorClass, dic.ErrorActionEntryClass());
            String msg = provider.getLocalizedErrorMessage(lastActionError);
            renderError(w, actionErrClass, msg);
        }

        // done
        list.endTag();
    }
View Full Code Here


                double height = Math.max(ci.getVSize(), 2) * 1.25;
                style +=  "height:" + height + "em";
            }
            // Wrap read only in a div if it's a control
            HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
            HtmlTag div = writer.startTag(dic.InputReadOnlyDataWrapperTag());
            div.addAttribute("id",    ci.getId());
            div.addAttribute("class", ci.getCssClass());
            div.addAttribute("style", style);
            div.beginBody();
            internalRenderText(writer, vi);
            div.endTag();
        }
        else
        {
            super.internalRenderText(writer, vi);
        }
View Full Code Here

    }

    private void renderError(HtmlWriter w, String cssClassName, String msg)
    {
        HtmlTagDictionary dic = HtmlTagDictionary.getInstance();
        HtmlTag tag = w.startTag(dic.ErrorEntryTag());
        // Check whether additional wrapper is desired
        String wrapTag = dic.ErrorEntryWrapperTag();
        if (wrapTag!=null && wrapTag.length()>0)
        {   tag.beginBody();
            // Item wrapper tag
            HtmlTag wrap = w.startTag(wrapTag);
            wrap.addAttribute("class", cssClassName);
            wrap.endTag(msg);
        }
        else
        {   // No additional error wrapper tag
            tag.addAttribute("class", cssClassName);
            tag.beginBody(msg);
View Full Code Here

    }
   
    @Override
    public void renderInput(HtmlWriter writer, ControlInfo ci)
    {
        HtmlTag input = writer.startTag("textarea");
        input.addAttribute("id",    ci.getId());
        input.addAttribute("class", ci.getCssClass());
        input.addAttribute("style", ci.getCssStyle());
        input.addAttribute("name",  ci.getName());
        input.addAttribute("disabled", ci.getDisabled());
        input.addAttribute("rows",  Math.max(ci.getVSize(), 2));
        input.addAttribute("cols",  Math.max(ci.getHSize(), 1));
        // maxlength
        if (ci.getDisabled()==false)
        {   // Get Max Length
            String checklength = getFormatOption(ci, "maxlength:");
            if (StringUtils.isNotEmpty(checklength))
            {   // Do lengthcheck via onKeyPress and onKeyUp Events
                int maxLength = (int)ci.getColumn().getSize();
                checklength = StringUtils.replace(checklength, "{0}", String.valueOf(maxLength));
                input.addAttribute("onkeypress", checklength);
                input.addAttribute("onkeyup",    checklength);
            }  
        }
        // Event Attributes
        input.addAttribute("onclick",   ci.getOnclick());
        input.addAttribute("onchange",  ci.getOnchange());
        input.addAttribute("onfocus",   ci.getOnfocus());
        input.addAttribute("onblur",    ci.getOnblur());
        // Body
        String value = StringUtils.toString(ci.getValue());
        value = StringEscapeUtils.escapeHtml(value);
        input.beginBody(value);
        // End
        input.endTag();
    }
View Full Code Here

            if (ObjectUtils.contains(keyColumns, col))
                continue;
            // Get the value from the input control
            Object value = null;
            String field = getRequestFieldName(col);
            InputControl control = null;
            if (record.isFieldReadOnly(col)==false)
                control = InputControlManager.getControl(col.getControlType());
            // Get Value from Control first
            if (control!=null && (value=control.getFieldValue(field, action, locale, col))!=null)
            {   // Check for Error
                if (value instanceof InputControl.FieldValueError)
                {
                    InputControl.FieldValueError fieldError = (InputControl.FieldValueError)value;
                    // Error
View Full Code Here

        {
            log.error("cannot determine action URL. Request object does not implement WebRequest");
            return null;
        }
        // We have a webRequest   
        WebRequest webRequest = (WebRequest)request;
        // Get the uri
        String uri = "/" + action;
        if (uri.indexOf('.')<0)
            uri += ".action";
        // now build the url
        return UrlHelperEx.buildUrl(uri, webRequest.getRequestContext(), webRequest.getResponseContext(), parameters, null, true, true);
    }
View Full Code Here

        {
            log.error("cannot determine action URL. Request object does not implement WebRequest");
            return null;
        }
        // We have a webRequest   
        WebRequest webRequest = (WebRequest)request;
        // Get the uri
        String uri = "/" + action;
        if (uri.indexOf('.')<0)
            uri += ".action";
        // now build the url
        return UrlHelperEx.buildUrl(uri, webRequest.getRequestContext(), webRequest.getResponseContext(), parameters, null, true, true);
    }
View Full Code Here

            if (portletContext.getAttribute( WebApplication.APPLICATION_NAME )==null)
            {
                Object app = createObject( appClassName );
                if (app instanceof WebApplication)
                {
                    ((WebApplication)app).init( new PortletContextWrapper(portletContext) );
                }
                else
                    log.warn("Application object does not implement IWebApplication!");
                // Store it
                portletContext.setAttribute( WebApplication.APPLICATION_NAME, app);
View Full Code Here

                // Store Request in Thread Local variable
                EmpireThreadManager.setCurrentRequest( reqObj );
                // Call init() if Request Object implements IWebRequest
                if (reqObj instanceof WebRequest)
                {
                  RequestContext req = new PortletRequestWrapper(request);
                  ResponseContext res = new PortletResponseWrapper(response);
                    return ((WebRequest)reqObj).init( req, res, sessObj );
                }
                else if (logRequestWarning)
                {
View Full Code Here

                EmpireThreadManager.setCurrentRequest( reqObj );
                // Call init() if Request Object implements IWebRequest
                if (reqObj instanceof WebRequest)
                {
                  RequestContext req = new PortletRequestWrapper(request);
                  ResponseContext res = new PortletResponseWrapper(response);
                    return ((WebRequest)reqObj).init( req, res, sessObj );
                }
                else if (logRequestWarning)
                {
                    log.warn("Request object does not implement IWebRequest!");
View Full Code Here

TOP

Related Classes of org.apache.empire.struts2.actionsupport.ActionError

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.