Package org.apache.beehive.netui.util.internal

Examples of org.apache.beehive.netui.util.internal.InternalStringBuilder


        return buf.toString();
    }

    public String toString() {
        InternalStringBuilder buf = new InternalStringBuilder();
        buf.append("ExpressionTerm:\n");
        for(int i = 0; i < _tokens.size(); i++) {
            buf.append("  " + _tokens.get(i).toString() + "\n");
        }
        return buf.toString();
    }
View Full Code Here


        }
        elem.onExpand(req, response);
        elem.setExpanded(expand);

        if (expandSvr != null) {
            InternalStringBuilder sb = new InternalStringBuilder(1024);
            StringBuilderRenderAppender writer = new StringBuilderRenderAppender(sb);
            // Start the document
            writeStartElement(writer, TREE_EXPAND_ELEM);

            // add a tree identifier
            writeElement(writer, "node", node);
            writeElement(writer, "treeId", tree);

            try {
                TreeElement children[] = elem.getChildren();
                AttributeRenderer extraAttrs = new AttributeRenderer();
                int newLevel = elem.getLevel() + 1;
                InternalStringBuilder treeRendering = new InternalStringBuilder();
                TreeElement tmp = elem;
                InheritableState iState = null;
                while (iState == null && tmp != null) {
                    iState = tmp.getInheritableState();
                    tmp = tmp.getParent();
                }
                if (iState == null) {
                    System.err.println("Unable to find InheritableState");
                    iState = root.getInheritableState();
                }

                ServletTreeRenderer str = new ServletTreeRenderer(root.getTreeRenderState(), req,
                        (HttpServletResponse) response, ctxt, writer, treeRendering);
                for (int i = 0; i < children.length; i++) {
                    treeRendering.setLength(0);
                    str.render(treeRendering, children[i], newLevel, extraAttrs, iState);
                }
            }
            catch (JspException se) {
                se.printStackTrace();
View Full Code Here

     * with the given request URI.
     */
    public static String getBeginActionURI( String requestURI )
    {
        // Translate this to a request for the begin action ("begin.do") for this PageFlowController.
        InternalStringBuilder retVal = new InternalStringBuilder();
        int lastSlash = requestURI.lastIndexOf( '/' );

        if ( lastSlash != -1 )
        {
            retVal.append( requestURI.substring( 0, lastSlash ) );
        }

        retVal.append( '/' ).append( BEGIN_ACTION_NAME ).append( ACTION_EXTENSION );
        return retVal.toString();
    }
View Full Code Here

     */
    private final String convertToEcmaScriptString(String string) {
        CharSequence cs = string;

        int len = cs.length();
        InternalStringBuilder buf = new InternalStringBuilder(len);
        for(int i = 0; i < len; i++) {
            char c = cs.charAt(i);
            // skip the \\ and consume the next character either appending it or turning it back into the single character
            // that it should have been in the first place.
            //
            // if slash and not at the last character...
            if(c == '\\' && i + 1 < len) {
                i++;

                // skip the slash
                c = cs.charAt(i);

                if(c == 'b')
                    c = '\b';
                else if(c == 't')
                    c = '\t';
                else if(c == 'n')
                    c = '\n';
                //else if(c == 'v') c = '\v';
                else if(c == 'f')
                    c = '\f';
                else if(c == 'r') c = '\r';
                // @TODO: unicode escaping...
            }

            buf.append(c);
        }

        if(LOGGER.isDebugEnabled()) LOGGER.debug("new _identifier: " + buf.toString());

        return buf.toString();
    }
View Full Code Here

       
        if ( actionOverride != null )
        {
            // The action must be fully-qualified with its module path.
            assert actionOverride.charAt( 0 ) == '/' : actionOverride;
            InternalStringBuilder uri = new InternalStringBuilder( scopedRequest.getContextPath() );
            uri.append( actionOverride );
            uri.append( PageFlowConstants.ACTION_EXTENSION );
            scopedRequest.setRequestURI( uri.toString() );
        }

        //
        // In case the request was already forwarded once, clear out the recorded forwarded-URI.  This
        // will allow us to tell whether processing the request actually forwarded somewhere.
View Full Code Here

                                           HttpServletResponse response, String actionName )
            throws URISyntaxException
    {
        if ( actionName.length() < 1 ) throw new IllegalArgumentException( "actionName must be non-empty" );
       
        InternalStringBuilder actionURI = new InternalStringBuilder( request.getContextPath() );
       
        if ( actionName.charAt( 0 ) != '/' )
        {
            actionURI.append( getModulePath( request ) );
            actionURI.append( '/' );
        }
       
        actionURI.append( actionName );
        if ( ! actionName.endsWith( ACTION_EXTENSION ) ) actionURI.append( ACTION_EXTENSION );
       
        FreezableMutableURI uri = new FreezableMutableURI();
        uri.setEncoding( response.getCharacterEncoding() );
        uri.setURI( actionURI.toString(), true );
        return uri;
    }
View Full Code Here

            scriptReporter.addTagIdMappings(tagId, realId, realName);
            return null;
        }

        // without a scripRepoter we need to create the actual JavaScript that will be written out
        InternalStringBuilder sb = new InternalStringBuilder(128);
        StringBuilderRenderAppender writer = new StringBuilderRenderAppender(sb);
        getTagIdMapping(tagId, realId, realName, writer);
        return sb.toString();
    }
View Full Code Here

            scriptReporter.addLegacyTagIdMappings(tagId, value);
            return null;
        }

        // without a scripRepoter we need to create the actual JavaScript that will be written out
        InternalStringBuilder sb = new InternalStringBuilder(64);
        StringBuilderRenderAppender writer = new StringBuilderRenderAppender(sb);
        getTagIdMapping(tagId, value, writer);
        return sb.toString();
    }
View Full Code Here

     * @return String
     */
    public String writeNetuiNameFunctions(IScriptReporter scriptReporter, boolean writeLegacy, boolean writeId, boolean writeName)
    {
        // allocate a String Buffer only if there is no script reporter
        InternalStringBuilder sb = null;
        if (scriptReporter == null)
            sb = new InternalStringBuilder(256);

        // if we are supporting legacy javascript then output the original javascript method
        if (TagConfig.isLegacyJavaScript() && writeLegacy) {
            writeLookupMethod(scriptReporter, sb, "getNetuiTagNameAdvanced", CoreScriptFeature.LEGACY_LOOKUP.value);
            writeLookupMethod(scriptReporter, sb, "getScopeId", CoreScriptFeature.LEGACY_SCOPE_LOOKUP.value);
        }

        // if we are supporting the default javascript then output the lookup methods for id and name
        if (TagConfig.isDefaultJavaScript()) {
            if (writeId)
                writeLookupMethod(scriptReporter, sb, "lookupIdByTagId", CoreScriptFeature.ID_LOOKUP.value);

            if (writeName)
                writeLookupMethod(scriptReporter, sb, "lookupNameByTagId", CoreScriptFeature.NAME_LOOKUP.value);

            if (writeId || writeName)
                writeLookupMethod(scriptReporter, sb, "lookupScopeId", CoreScriptFeature.SCOPE_LOOKUP.value);
        }

        return (sb != null) ? sb.toString() : null;
    }
View Full Code Here

     * @param realName
     * @param results
     */
    private void getTagIdMapping(String tagId, String realId, String realName, AbstractRenderAppender results)
    {
        InternalStringBuilder sb = new InternalStringBuilder(128);
        if (realId != null) {
            if ((_javaScriptFeatures & CoreScriptFeature.ALLOCATE_ID.value) == 0) {
                _javaScriptFeatures |= CoreScriptFeature.ALLOCATE_ID.value;
                String meths = writeNetuiNameFunctions(null, false, true, false);
                if (meths != null)
                    sb.append(meths);
            }
        }

        if (realName != null) {
            if ((_javaScriptFeatures & CoreScriptFeature.ALLOCATE_NAME.value) == 0) {
                _javaScriptFeatures |= CoreScriptFeature.ALLOCATE_NAME.value;
                String s = getString("singleIdToNameMappingTable", new Object[]{tagId, realName});
                String meths = writeNetuiNameFunctions(null, false, false, true);
                if (meths != null)
                    s += meths;
                sb.append(s);
            }
            else {
                String s = getString("tagIdNameMappingEntry", new Object[]{tagId, realName});
                sb.append(s);
            }
        }
        writeScriptBlock(_req, results, sb.toString());
    }
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.util.internal.InternalStringBuilder

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.