Examples of ByRef


Examples of org.apache.beehive.netui.tags.ByRef

            return reportAndExit(EVAL_PAGE);

        _state.disabled = isDisabled();

        //Create hidden field for state tracking
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // Only write out the hidden field if the select is not
        // disabled.  If it is disabled, then nothing will be posted
        // back from this.
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        if (!_state.disabled) {
            _hiddenState.clear();
            String hiddenParamName = null;
            hiddenParamName = _state.name + OLDVALUE_SUFFIX;
            _hiddenState.name = hiddenParamName;
            _hiddenState.value = "true";

            TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);
            hiddenTag.doStartTag(writer, _hiddenState);
            hiddenTag.doEndTag(writer);
            write("\n");
        }

        // Render any formatting errors that may have occurred.
        if (fmtErrors != null)
            write(fmtErrors);


        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.SELECT_TAG, req);
        br.doStartTag(writer, _state);

        // Render the content of the body, these would be the options
        if (_saveBody != null) {
            write(_saveBody);
        }

        // if we are repeating then the body contained the options so we can exit here
        if (_repeater) {

            if (hasErrors())
                return reportAndExit(EVAL_PAGE);

            br.doEndTag(writer);
            if (!ref.isNull())
                write((String) ref.getRef());

            // Continue processing this page
            localRelease();
            return EVAL_PAGE;
        }

        // All of the code below will pass through the optionsDataSource, the dataSource and defaultValue and
        // create a full Select.
        if (_dynamicOptions != null) {
            if (_dynamicOptions instanceof Map) {
                Map dynamicOptionsMap = (Map) _dynamicOptions;
                Iterator keyIterator = dynamicOptionsMap.keySet().iterator();
                while (keyIterator.hasNext()) {
                    Object optionValue = keyIterator.next();
                    String optionDisplay = null;
                    if (dynamicOptionsMap.get(optionValue) != null) {
                        optionDisplay = dynamicOptionsMap.get(optionValue).toString();
                    }

                    if (optionValue != null) {
                        addOption(req, optionValue.toString(), optionDisplay);
                    }
                }
            }
            else if (_dynamicOptions instanceof Iterator) {
                Iterator dynamicOptionsIterator = (Iterator) evaluateOptionsDataSource();
                while (dynamicOptionsIterator.hasNext()) {
                    Object o = dynamicOptionsIterator.next();
                    if (o != null) {
                        String optionValue = o.toString();
                        addOption(req, optionValue, optionValue);
                    }
                }
            }
        }

        // add the value from the DataSource and Default value
        addDatasourceIfNeeded(req);
        addDefaultsIfNeeded(req);
        if (_nullable && !isMultiple()) {
            String txt = (_nullableOptionText != null) ? _nullableOptionText : "";
            addOption(req, NULL_VALUE, txt);
        }

        br.doEndTag(writer);
        if (!ref.isNull())
            write((String) ref.getRef());

        // Continue processing this page
        localRelease();
        return EVAL_PAGE;
    }
View Full Code Here

Examples of org.apache.beehive.netui.tags.ByRef

        Object val = evaluateDataSource();
        textObject = (val != null) ? val : "";
        assert(textObject != null);

        // setup the rest of the state.
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        _state.disabled = isDisabled();

        // if there were expression errors report them
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // if there were format errors then report them
        if (_formatErrors) {
            if (bodyContent != null) {
                String value = bodyContent.getString().trim();
                bodyContent.clearBody();
                write(value);
            }
        }

        // create the input tag.
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.TEXT_AREA_TAG, req);
        br.doStartTag(writer, _state);

        // create the text value which will be found inside the textarea.
        if ((textObject == null) || (textObject.toString().length() == 0)) {
            textObject = _defaultValue;
        }

        String text = formatText(textObject);
        if (text != null) {
            writer.append("\n");
            HtmlUtils.filter(text, writer);
        }

        //results.append(text);
        br.doEndTag(writer);

        // if there are errors report them...
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // report any script
        if (!ref.isNull())
            write((String) ref.getRef());

        localRelease();
        return EVAL_PAGE;
    }
View Full Code Here

Examples of org.apache.beehive.netui.tags.ByRef

            return reportAndExit(EVAL_PAGE);

        _state.disabled = isDisabled();

        //Create hidden field for state tracking
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // Only write out the hidden field if the select is not
        // disabled.  If it is disabled, then nothing will be posted
        // back from this.
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        if (!_state.disabled) {
            _hiddenState.clear();
            String hiddenParamName = null;
            hiddenParamName = _state.name + OLDVALUE_SUFFIX;
            _hiddenState.name = hiddenParamName;
            _hiddenState.value = "true";

            TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);
            hiddenTag.doStartTag(writer, _hiddenState);
            hiddenTag.doEndTag(writer);
            write("\n");
        }

        // Render any formatting errors that may have occurred.
        if (fmtErrors != null)
            write(fmtErrors);


        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.SELECT_TAG, req);
        br.doStartTag(writer, _state);

        // Render the content of the body, these would be the options
        if (_saveBody != null) {
            write(_saveBody);
        }

        // if we are repeating then the body contained the options so we can exit here
        if (_repeater) {

            if (hasErrors())
                return reportAndExit(EVAL_PAGE);

            br.doEndTag(writer);
            if (!ref.isNull())
                write((String) ref.getRef());

            // Continue processing this page
            localRelease();
            return EVAL_PAGE;
        }

        // All of the code below will pass through the optionsDataSource, the dataSource and defaultValue and
        // create a full Select.
        if (_dynamicOptions != null) {
            if (_dynamicOptions instanceof Map) {
                Map dynamicOptionsMap = (Map) _dynamicOptions;
                Iterator keyIterator = dynamicOptionsMap.keySet().iterator();
                while (keyIterator.hasNext()) {
                    Object optionValue = keyIterator.next();
                    String optionDisplay = null;
                    if (dynamicOptionsMap.get(optionValue) != null) {
                        optionDisplay = dynamicOptionsMap.get(optionValue).toString();
                    }

                    addOption(req, optionValue.toString(), optionDisplay);
                }
            }
            else if (_dynamicOptions instanceof Iterator) {
                Iterator dynamicOptionsIterator = (Iterator) evaluateOptionsDataSource();
                while (dynamicOptionsIterator.hasNext()) {
                    Object o = dynamicOptionsIterator.next();
                    if (o != null) {
                        String optionValue = o.toString();
                        addOption(req, optionValue, optionValue);
                    }
                }
            }
        }

        // add the value from the DataSource and Default value
        addDatasourceIfNeeded(req);
        addDefaultsIfNeeded(req);
        if (_nullable && !isMultiple()) {
            String txt = (_nullableOptionText != null) ? _nullableOptionText : "";
            addOption(req, NULL_VALUE, txt);
        }

        br.doEndTag(writer);
        if (!ref.isNull())
            write((String) ref.getRef());

        // Continue processing this page
        localRelease();
        return EVAL_PAGE;
    }
View Full Code Here

Examples of org.apache.beehive.netui.tags.ByRef

            _state.type = INPUT_TEXT;
        }


        // Create the state for the input tag
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        _state.disabled = isDisabled();

        // Create the text value of the TextBox
        Object textObject = evaluateDataSource();
        if ((textObject == null) || (textObject.toString().length() == 0)) {
            textObject = _defaultValue;
        }

        // Get the text value for the textbox, the result
        String text = null;
        if (textObject != null) {
            text = formatText(textObject);
            InternalStringBuilder sb = new InternalStringBuilder(text.length() + 16);
            StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb);
            HtmlUtils.filter(text, sbAppend);
            text = sb.toString();
        }
        _state.value = text;

        // if there were format errors then report them
        if (_formatErrors) {
            if (bodyContent != null) {
                String value = bodyContent.getString().trim();
                bodyContent.clearBody();
                write(value);
            }
        }

        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // create the input tag.
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_TEXT_TAG, req);
        assert(br != null);

        br.doStartTag(writer, _state);
        br.doEndTag(writer);

        // write any script that needs to be written
        if (!ref.isNull())
            write((String) ref.getRef());

        localRelease();
        return EVAL_PAGE;
    }
View Full Code Here

Examples of org.apache.beehive.netui.tags.ByRef

        Object val = evaluateDataSource();
        textObject = (val != null) ? val : "";
        assert(textObject != null);

        // setup the rest of the state.
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        _state.disabled = isDisabled();

        // if there were expression errors report them
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // if there were format errors then report them
        if (_formatErrors) {
            if (bodyContent != null) {
                String value = bodyContent.getString().trim();
                bodyContent.clearBody();
                write(value);
            }
        }

        // create the input tag.
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.TEXT_AREA_TAG, req);
        br.doStartTag(writer, _state);

        // create the text value which will be found inside the textarea.
        if ((textObject == null) || (textObject.toString().length() == 0)) {
            textObject = _defaultValue;
        }

        String text = formatText(textObject);
        if (text != null)
            HtmlUtils.filter(text, writer);

        //results.append(text);
        br.doEndTag(writer);

        // if there are errors report them...
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // report any script
        if (!ref.isNull())
            write((String) ref.getRef());

        localRelease();
        return EVAL_PAGE;
    }
View Full Code Here

Examples of org.apache.beehive.netui.tags.ByRef

        // report errors that may have occurred when the required attributes are being set
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        // build the anchor into the results
        ByRef script = new ByRef();

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
        TagRenderingBase trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.AREA_TAG, request);

        if (!createAnchorBeginTag(request, script, trb, writer, REQUIRED_ATTR)) {
            if (!script.isNull())
                write(script.getRef().toString());
            return reportAndExit(EVAL_PAGE);
        }

        assert(trb != null) : "trb is null";
        trb.doEndTag(writer);

        if (!script.isNull())
            write(script.getRef().toString());

        // Render the remainder to the output stream
        localRelease();
        return EVAL_PAGE;
    }
View Full Code Here

Examples of org.apache.beehive.netui.tags.ByRef

        if (val != null) {
            _value = val.toString();
        }

        // Create an appropriate "input" element based on our parameters
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        if (_value != null) {
            InternalStringBuilder sb = new InternalStringBuilder(_value.length() + 16);
            StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb);
            HtmlUtils.filter(_value, sbAppend);
            _state.value = sb.toString();
        }

        // correct for null text here
        if (_state.value == null)
            _state.value = "";

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);

        hiddenTag.doStartTag(writer, _state);
        hiddenTag.doEndTag(writer);

        if (!ref.isNull())
            write((String) ref.getRef());

        // Continue processing this page
        localRelease();
        return SKIP_BODY;
    }
View Full Code Here

Examples of org.apache.beehive.netui.tags.ByRef

        // build the anchor into the results
        // render the anchor tag
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req);
        ByRef script = new ByRef();
        if (!createAnchorBeginTag(req, script, trb, writer, REQUIRED_ATTR)) {
            reportErrors();
            if (!script.isNull())
                write(script.getRef().toString());
            localRelease();
            return EVAL_PAGE;
        }

        // set the source and lowsrc attributes
        // the lowsrc is deprecated and should be removed.
        HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
        if (_imgState.src != null) {
            try {
                String uri = PageFlowTagUtils.rewriteResourceURL(pageContext, _imgState.src, null, null);
                _imgState.src = response.encodeURL(uri);
            }
            catch (URISyntaxException e) {
                // report the error...
                String s = Bundle.getString("Tags_Image_URLException",
                        new Object[]{_imgState.src, e.getMessage()});
                registerTagError(s, e);
            }
        }

        // set the rollover image
        if (_rolloverImage != null) {
            try {
                String uri = PageFlowTagUtils.rewriteResourceURL(pageContext, _rolloverImage, null, null);
                _rolloverImage = response.encodeURL(qualifyUrlToContext(uri));
            }
            catch (URISyntaxException e) {
                // report the error...
                String s = Bundle.getString("Tags_Rollover_Image_URLException",
                        new Object[]{_rolloverImage, e.getMessage()});
                registerTagError(s, e);
            }

            if (getJavaScriptAttribute(ONMOUSEOUT) == null) {
                String s = "swapImage(this,'" + response.encodeURL(_imgState.src) + "')";
                _imgState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOUT, s);
            }
            if (getJavaScriptAttribute(ONMOUSEOVER) == null) {
                String s = "swapImage(this,'" + response.encodeURL(_rolloverImage) + "')";
                _imgState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOVER, s);
            }
        }

        // render the image tag.
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.IMAGE_TAG, req);
        br.doStartTag(writer, _imgState);
        br.doEndTag(writer);

        // write the end tag
        trb.doEndTag(writer);
        if (!script.isNull())
            write(script.getRef().toString());

        localRelease();
        return EVAL_PAGE;
    }
View Full Code Here

Examples of org.apache.beehive.netui.tags.ByRef

            registerTagError(s, null);
            return EVAL_PAGE;
        }

        // Create the state for the input tag.
        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        WriteRenderAppender writer = new WriteRenderAppender(pageContext);
        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_FILE_TAG, req);
        br.doStartTag(writer, _state);

        if (!ref.isNull())
            write((String) ref.getRef());

        localRelease();
        return EVAL_PAGE;
    }
View Full Code Here

Examples of org.apache.beehive.netui.tags.ByRef

        Object val = evaluateDataSource();
        if (hasErrors())
            return reportAndExit(EVAL_PAGE);

        ByRef ref = new ByRef();
        nameHtmlControl(_state, ref);

        String hiddenParamName = _state.name + OLDVALUE_SUFFIX;
        ServletRequest req = pageContext.getRequest();

        if (val instanceof String) {
            if (val != null && Boolean.valueOf(val.toString()).booleanValue())
                _state.checked = true;
            else
                _state.checked = false;
        }
        else if (val instanceof Boolean) {
            _state.checked = ((Boolean) val).booleanValue();
        }
        else {
            String oldCheckBoxValue = req.getParameter(hiddenParamName);
            if (oldCheckBoxValue != null) {
                _state.checked = new Boolean(oldCheckBoxValue).booleanValue();
            }
            else {
                _state.checked = evaluateDefaultValue();
            }
        }
        _state.disabled = isDisabled();

        //Create a hidden field to store the CheckBox oldValue
        String oldValue = req.getParameter(_state.name);
        WriteRenderAppender writer = new WriteRenderAppender(pageContext);

        // if the checkbox is disabled we need to not write out the hidden
        // field because it can cause the default state to change from
        // true to false.  Disabled check boxes do not postback.
        if (!_state.disabled) {
            _hiddenState.name = hiddenParamName;
            if (oldValue == null) {
                _hiddenState.value = "false";
            }
            else {
                _hiddenState.value = oldValue;
            }
            TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);
            hiddenTag.doStartTag(writer, _hiddenState);
            hiddenTag.doEndTag(writer);
        }

        _state.type = INPUT_CHECKBOX;

        TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_BOOLEAN_TAG, req);
        br.doStartTag(writer, _state);

        if (!ref.isNull())
            write((String) ref.getRef());

        // Continue processing this page
        localRelease();
        return EVAL_PAGE;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.