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

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


    public void seal() {
        _context = (ContextToken)_tokens.get(0);
        _tokenArray = new ExpressionToken[_tokens.size()];

        InternalStringBuilder buf = new InternalStringBuilder();
        for(int i = 0; i < _tokens.size(); i++) {
            buf.append(((ExpressionToken)_tokens.get(i)).getTokenString());
            _tokenArray[i] = (ExpressionToken)_tokens.get(i);
        }

        _exprStr = buf.toString();

        _noModTokens = Collections.unmodifiableList(_tokens);
    }
View Full Code Here


        if(start >= _tokens.size())
            throw new IllegalStateException("The index \"" + start + "\" is an invalid reference into an expression with \"" +
                _tokens.size() + "\" _tokens.");

        boolean needDot = true;
        InternalStringBuilder buf = new InternalStringBuilder();
        buf.append("{");
        for(int i = start; i < _tokens.size(); i++) {
            ExpressionToken tok = (ExpressionToken)_tokens.get(i);
            if(tok instanceof ArrayIndexToken) {
                buf.append(tok.getTokenString());
                needDot = false;
            } else if(tok instanceof IdentifierToken) {
                if(needDot && i != start) buf.append(".");
                buf.append(tok.toString());
                needDot = true;
            } else if(tok instanceof MapKeyToken) {
                buf.append(tok.getTokenString());
                needDot = false;
            }
        }
        buf.append("}");
        return buf.toString();
    }
View Full Code Here

        if(LOGGER.isDebugEnabled()) LOGGER.debug("thisExpr: " + thisExpr + " ctxStr: " + ctxStr);

        thisExpr = thisExpr.replaceFirst(oldContext, ctxStr);

        InternalStringBuilder buf = new InternalStringBuilder();
        buf.append("{");
        buf.append(thisExpr);
        buf.append("}");

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

        return buf.toString();
    }

    public String qualify(String contextName) {
        InternalStringBuilder buf = new InternalStringBuilder();
        buf.append("{");
        buf.append(contextName);
        buf.append(".");
        buf.append(getExpressionString());
        buf.append("}");

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

            throw new IllegalArgumentException(Bundle.getErrorString("ProcessPopulate_handler_nonAtomicExpression", new Object[] {expression}));

        if(!handlerMap.containsKey(handler))
            throw new IllegalStateException(Bundle.getErrorString("ProcessPopulate_handler_notRegistered", new Object[] {handler}));

        InternalStringBuilder buf = new InternalStringBuilder();
        buf.append(WLW_TAG_HANDLER_PREFIX);
        buf.append(handler);
        buf.append(WLW_TAG_HANDLER_SUFFIX);
        buf.append(expression);

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

        // can't be constructed outside of this class
        private ExpressionUpdateNode() {}

        public String toString()
        {
            InternalStringBuilder buf = new InternalStringBuilder();
            buf.append("expression: " + expression + "\n");
            if(values != null)
                for(int i = 0; i < values.length; i++)
                    buf.append("value[" + i + "]: " + values[i]);
            else buf.append("values are null");

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

    public Enumeration getKeys() {
        throw new UnsupportedOperationException("The getKeys() method is not supported on the MessageResources type.");
    }

    public String toString() {
        InternalStringBuilder sb = new InternalStringBuilder();
        sb.append("StrutsBundleNode ");
        sb.append("messageResource: ");
        sb.append(_messageResource);
        sb.append(" ");
        sb.append("locale: ");
        sb.append(_locale);
        return sb.toString();
    }
View Full Code Here

    public Enumeration getKeys() {
        return _bundle != null ? _bundle.getKeys() : null;
    }

    public String toString() {
        InternalStringBuilder sb = new InternalStringBuilder();
        sb.append("ResourceBundleNode ");
        Enumeration keys = getKeys();
        if(keys != null) {
            boolean first = true;
            sb.append("{");
            while(keys.hasMoreElements()) {
                if(!first)
                    sb.append(",");
                else first = false;

                String key = (String)keys.nextElement();
                sb.append(key);
                sb.append("=");
                sb.append(getString(key));
            }
            sb.append("}");
        }
        return sb.toString();
    }
View Full Code Here

        public String format(Object dataToFormat) throws JspException
        {
            if (dataToFormat == null) {
                return null;
            }
            InternalStringBuilder formattedString = new InternalStringBuilder(32);
            DecimalFormat numberFormat = null;

            // get the number format.  The type has been validated when it was set on the tag.
            if (locale == null) {
                if ((type == null) || (type.equals("number"))) {
                    numberFormat = (DecimalFormat) java.text.NumberFormat.getNumberInstance();
                }
                else if (type.equals("currency")) {
                    numberFormat = (DecimalFormat) java.text.NumberFormat.getCurrencyInstance();
                }
                else if (type.equals("percent")) {
                    numberFormat = (DecimalFormat) java.text.NumberFormat.getPercentInstance();
                }
                else {
                    assert(false) : "Invalid type was found:" + type;
                }
            }
            else {
                if ((type == null) || (type.equals("number"))) {
                    numberFormat = (DecimalFormat) java.text.NumberFormat.getNumberInstance(locale);
                }
                else if (type.equals("currency")) {
                    numberFormat = (DecimalFormat) java.text.NumberFormat.getCurrencyInstance(locale);
                }
                else if (type.equals("percent")) {
                    numberFormat = (DecimalFormat) java.text.NumberFormat.getPercentInstance(locale);
                }
                else {
                    assert(false) : "Invalid type was found:" + type;
                }
            }

            // format the number, apply the pattern specified
            try {
                if (getPattern() != null)
                    numberFormat.applyPattern(getPattern());
            }
            catch (Exception e) {
                throw new JspException(Bundle.getString("Tags_NumberFormatPatternException", e.getMessage()), e);
            }

            // parse the number
            if (dataToFormat.toString().length() == 0) {
                return "";
            }
            try {
                double number = Double.parseDouble(dataToFormat.toString());
                formattedString.append(numberFormat.format(number));
            }
            catch (Exception e) {
                throw new JspException(Bundle.getString("Tags_NumberFormatParseException", e.getMessage()), e);
            }

            return formattedString.toString();

        }
View Full Code Here

           
        public void addParam( String name, Object value )
        {
            if ( _logMessage == null )
            {
                _logMessage = new InternalStringBuilder( _eventName ).append( ": " );
            }
            else
            {
                _logMessage.append( ", " );
            }
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.