/** * Pops a context object out of the stack. * * @param tilesContext The Tiles context object to use. * @return The popped context object. * @since 2.0.6 */ protected AttributeContext popContext(Request tilesContext) { Deque<AttributeContext> contextStack = getContextStack(tilesContext); return contextStack.pop(); }
/** * Pushes a context object in the stack. * * @param context The context to push. * @param tilesContext The Tiles context object to use. * @since 2.0.6 */ protected void pushContext(AttributeContext context, Request tilesContext) { Deque<AttributeContext> contextStack = getContextStack(tilesContext); contextStack.push(context); }
/** * Pops a context object out of the stack. * * @param tilesContext The Tiles context object to use. * @return The popped context object. * @since 2.0.6 */ protected AttributeContext popContext(TilesRequestContext tilesContext) { Stack<AttributeContext> contextStack = getContextStack(tilesContext); return contextStack.pop(); }
/** * Pushes a context object in the stack. * * @param context The context to push. * @param tilesContext The Tiles context object to use. * @since 2.0.6 */ protected void pushContext(AttributeContext context, TilesRequestContext tilesContext) { Stack<AttributeContext> contextStack = getContextStack(tilesContext); contextStack.push(context); }
/** * Get attribute context from request. * * @param tilesContext current Tiles application context. * @return BasicAttributeContext or null if context is not found. * @since 2.0.6 */ protected AttributeContext getContext(Request tilesContext) { Deque<AttributeContext> contextStack = getContextStack(tilesContext); if (!contextStack.isEmpty()) { return contextStack.peek(); } return null; }
/** * Get attribute context from request. * * @param tilesContext current Tiles application context. * @return BasicAttributeContext or null if context is not found. * @since 2.0.6 */ protected AttributeContext getContext(TilesRequestContext tilesContext) { Stack<AttributeContext> contextStack = getContextStack(tilesContext); if (!contextStack.isEmpty()) { return contextStack.peek(); } else { return null; } }
/** {@inheritDoc} */ public AttributeContext startContext(Request request) { AttributeContext context = new BasicAttributeContext(); Deque<AttributeContext> stack = getContextStack(request); if (!stack.isEmpty()) { AttributeContext parent = stack.peek(); context.inheritCascadedAttributes(parent); } stack.push(context); return context; }
/** * Starts an attribute context inside the container. * * @param tilesContext The request context to use. * @return The newly created attribute context. */ private AttributeContext startContext(TilesRequestContext tilesContext) { AttributeContext context = new BasicAttributeContext(); Stack<AttributeContext> stack = getContextStack(tilesContext); if (!stack.isEmpty()) { AttributeContext parent = stack.peek(); context.inheritCascadedAttributes(parent); } stack.push(context); return context; }