Package org.apache.commons.collections

Examples of org.apache.commons.collections.ArrayStack


    public static void clearBreadCrumbTrail( HttpServletRequest req )
    {
        HttpSession ses = req.getSession(false);
        if (ses != null && ses.getAttribute(BREADCRUMB) != null)
        {
            ArrayStack stack = (ArrayStack)ses.getAttribute(BREADCRUMB);
            stack.clear();
        }
    }
View Full Code Here


        String crumb = null;
       
        HttpSession ses = req.getSession(false);
        if (ses != null && ses.getAttribute(BREADCRUMB) != null)
        {
            ArrayStack stack = (ArrayStack) ses.getAttribute(BREADCRUMB);
            if (stack != null && !stack.empty())
            {
                crumb = (String)stack.peek();
            }
        }

        if ( crumb == null && useReferer )
        {
View Full Code Here

    {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) resp;

        HttpSession ses = request.getSession(false);
        ArrayStack stack = null;
        if (ses != null)
        {
            stack = (ArrayStack)ses.getAttribute(RollerSession.BREADCRUMB);
        }
        if (stack == null)
        {
            stack = new ArrayStack();
        }

        // This gives you a chance to look at your breadcrumb trail
        if (request.getQueryString() != null
            && request.getQueryString().equals("BreadCrumb"))
        {
            response.setContentType("text/html; charset=UTF-8");
            ServletOutputStream out = response.getOutputStream();

            for (int i=0; i<stack.size(); i++)
            {
                out.println(stack.peek(i).toString() +"<br>");
            }
            out.flush();
            out.close();
        }
        else
        {
            chain.doFilter(req, resp);
        }

        StringBuffer url = request.getRequestURL();
        // now that we've successfully returned,
        // add url to stack if it isn't a Velocity page
        String servletPath = request.getServletPath();
        if (servletPath.indexOf("page") == -1 &&
            servletPath.indexOf("comments") == -1)
        {   
            if (request.getQueryString() != null)
            {
                url.append("?").append( request.getQueryString() );
            }
            if (stack.size() == mMaxStackSize)
            {
                stack.remove(mMaxStackSize-1);
            }
            stack.push(url.toString());
        }
        if (ses != null)
        {   
          ses.setAttribute(RollerSession.BREADCRUMB, stack);
        }
View Full Code Here

     */
    public synchronized File getBaseDirRelative() {
        // Must first convert to absolute path names to ensure parents are available
        File parent = new File(DEFAULT_BASE).getAbsoluteFile();
        File f = base.getAbsoluteFile();
        ArrayStack l = new ArrayStack();
        while (f != null) {
            if (f.equals(parent)){
                if (l.isEmpty()){
                    break;
                }
                File rel = new File((String) l.pop());
                while(!l.isEmpty()) {
                    rel = new File(rel, (String) l.pop());
                }
                return rel;
            }
            l.push(f.getName());
            f = f.getParentFile();
        }
        return new File(".");
    }
View Full Code Here

        throws Exception
    {
        this.db = db;
        currentParentId = parentId;
        currentCursor = cursor;
        cursorStack = new ArrayStack();
        parentIdStack = new ArrayStack();
        this.baseId = baseId;
        this.topLevel = topLevel;

        if ( IS_DEBUG )
        {
View Full Code Here

    protected Buffer decorateBuffer(Buffer buffer, Predicate predicate) {
        return PredicatedBuffer.decorate(buffer, predicate);
    }
   
    public Collection makeCollection() {
        return decorateBuffer(new ArrayStack(), truePredicate);
    }
View Full Code Here

    public Collection makeCollection() {
        return decorateBuffer(new ArrayStack(), truePredicate);
    }
   
    public Collection makeConfirmedCollection() {
        return new ArrayStack();
    }
View Full Code Here

    public Collection makeConfirmedCollection() {
        return new ArrayStack();
    }
   
    public Collection makeConfirmedFullCollection() {
        ArrayStack list = new ArrayStack();
        list.addAll(java.util.Arrays.asList(getFullElements()));
        return list;
    }
View Full Code Here

    }
   
    //------------------------------------------------------------
   
    public Buffer makeTestBuffer() {
        return decorateBuffer(new ArrayStack(), testPredicate);
    }
View Full Code Here

        String[] testCaseName = { TestTransformedBuffer.class.getName()};
        junit.textui.TestRunner.main(testCaseName);
    }

    public void testTransformedBuffer() {
        Buffer buffer = TransformedBuffer.decorate(new ArrayStack(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
        assertEquals(0, buffer.size());
        Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
        for (int i = 0; i < els.length; i++) {
            buffer.add(els[i]);
            assertEquals(i + 1, buffer.size());
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.ArrayStack

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.