static boolean isIterating(FaceletContext context){ @SuppressWarnings("unchecked") Deque<Set<String>> iterationIds = (Deque<Set<String>>)context.getAttribute(_STACK_OF_TRACKED_IDS); return ((iterationIds != null) && (iterationIds.peek() != null)); }
static boolean isIterating(FaceletContext context){ @SuppressWarnings("unchecked") Deque<Set<String>> iterationIds = (Deque<Set<String>>)context.getAttribute(_STACK_OF_TRACKED_IDS); return ((iterationIds != null) && (iterationIds.peek() != null)); }
static boolean isIterating(FaceletContext context){ @SuppressWarnings("unchecked") Deque<Set<String>> iterationIds = (Deque<Set<String>>)context.getAttribute(_STACK_OF_TRACKED_IDS); return ((iterationIds != null) && (iterationIds.peek() != null)); }
static boolean isIterating(FaceletContext context){ @SuppressWarnings("unchecked") Deque<Set<String>> iterationIds = (Deque<Set<String>>)context.getAttribute(_STACK_OF_TRACKED_IDS); return ((iterationIds != null) && (iterationIds.peek() != null)); }
private static Deque<Set<String>> _getStackOfTrackedIds(FaceletContext ctx) { Deque<Set<String>> stack = (Deque<Set<String>>)ctx.getAttribute(_STACK_OF_TRACKED_IDS); if (stack == null) { stack = new LinkedList<Set<String>>(); ctx.setAttribute(_STACK_OF_TRACKED_IDS, stack); } return stack; }
/** * @see Faces#getFaceletAttribute(String) */ @SuppressWarnings("unchecked") public static <T> T getFaceletAttribute(FacesContext context, String name) { return (T) getFaceletContext(context).getAttribute(name); }
/** * @see Faces#getFaceletAttribute(String) */ @SuppressWarnings("unchecked") public static <T> T getFaceletAttribute(FacesContext context, String name) { return (T) getFaceletContext(context).getAttribute(name); }
private static Deque<Set<String>> _getStackOfTrackedIds(FaceletContext ctx) { Deque<Set<String>> stack = (Deque<Set<String>>)ctx.getAttribute(_STACK_OF_TRACKED_IDS); if (stack == null) { stack = new LinkedList<>(); ctx.setAttribute(_STACK_OF_TRACKED_IDS, stack); } return stack; }
private static Deque<Set<String>> _getStackOfTrackedIds(FaceletContext ctx) { Deque<Set<String>> stack = (Deque<Set<String>>)ctx.getAttribute(_STACK_OF_TRACKED_IDS); if (stack == null) { stack = new LinkedList<>(); ctx.setAttribute(_STACK_OF_TRACKED_IDS, stack); } return stack; }
private static Deque<Set<String>> _getStackOfTrackedIds(FaceletContext ctx) { Deque<Set<String>> stack = (Deque<Set<String>>)ctx.getAttribute(_STACK_OF_TRACKED_IDS); if (stack == null) { stack = new LinkedList<>(); ctx.setAttribute(_STACK_OF_TRACKED_IDS, stack); } return stack; }
PageMetaModelContextException Object value = context.getAttribute(this.attribute); PageMetaModel page;
FaceletContext faceletContext = (FaceletContext) FacesContext.getCurrentInstance().getAttributes() .get(FaceletContext.FACELET_CONTEXT_KEY); Object resolvedBase = faceletContext.getAttribute(variableName); if (resolvedBase != null) { if (endOfBaseName == end + 2) {
FaceletContext faceletContext = (FaceletContext) FacesContext.getCurrentInstance().getAttributes() .get(FaceletContext.FACELET_CONTEXT_KEY); Object resolvedBase = faceletContext.getAttribute(variableName); if (resolvedBase != null) { if (endOfBaseName == end + 2) {
@Override public void applyNextHandler(FaceletContext ctx, UIComponent c) throws java.io.IOException, javax.faces.FacesException, javax.el.ELException { // onComponentCreated(-) is called on GET and POST restore view, // but not POST render. // In applyNextHandler(-), on GET and POST restore view, // c.parent is null, but in POST render c.parent is non-null. // So for POST render, check if should skip in applyNextHandler(-), // using the non-null parent as the switch UIComponent parent = c.getParent(); //parent might be c:forEach between the stackPanes and the panelStack if (parent != null) { String key = SELECTED_ID_KEY + parent.getClientId(); String selectedId = (String)ctx.getAttribute(key); logger.finer("CPH.applyNextHandler() for StackPaneHandler parent id="+parent.getClientId() +" has selectedId="+selectedId); updateFlagShouldOptimiseSkipChildConstruction(ctx, c, parent); } Boolean skip = (Boolean) c.getAttributes().get(SKIP_CONSTRUCTION_KEY); if (skip == null || !skip.booleanValue()) { logger.log(Level.FINE, "pane Id=" + savedId.getValue(ctx) + "\t\tConstruct children"); super.applyNextHandler(ctx, c); } else { logger.log(Level.FINE, "paneId=" + savedId.getValue(ctx) + "\t\tDont construct children"); } }
String fromAttMap = (String)ctx.getAttribute(key); if (fromAttMap !=null && fromAttMap.length()>0){ selectedId=fromAttMap;
public void testApplyVar() throws IOException { Authentication authentication = AuthenticationFactory.authentication(Roles.ROLE_A); new SpringSecurityMock().init(authentication); MockTagAttribute myVariableTagAttribute = new MockTagAttribute("myVariable"); getJsfMock().getMockTagAttributes().getTagAttributes().put( "var", myVariableTagAttribute); getJsfMock().getMockTagAttributes().getTagAttributes().put( "ifAllGranted", new MockTagAttribute(Roles.ROLE_A)); FaceletContext mockFaceletContext = getJsfMock().getMockFaceletContext(); AuthorizeFaceletsTagHandler tag = new AuthorizeFaceletsTagHandler( getJsfMock().getMockTagConfig()); tag.apply(mockFaceletContext, null); assertThat(mockFaceletContext.getAttribute("myVariable")) .isEqualTo(Boolean.TRUE); }
@Test public void testApplyVar() throws IOException { Authentication authentication = AuthenticationFactory.authentication(Roles.ROLE_A); new SpringSecurityMock().init(authentication); MockTagAttribute myVariableTagAttribute = new MockTagAttribute("myVariable"); getJsfMock().getMockTagAttributes().getTagAttributes().put( "var", myVariableTagAttribute); getJsfMock().getMockTagAttributes().getTagAttributes().put( "ifAllGranted", new MockTagAttribute(Roles.ROLE_A)); FaceletContext mockFaceletContext = getJsfMock().getMockFaceletContext(); AuthorizeFaceletsTagHandler tag = new AuthorizeFaceletsTagHandler( getJsfMock().getMockTagConfig()); tag.apply(mockFaceletContext, null); assertThat(mockFaceletContext.getAttribute("myVariable")) .isEqualTo(Boolean.TRUE); }
@Test public void testApplyVar() throws IOException { Authentication authentication = AuthenticationFactory.authentication(Roles.ROLE_A); new SpringSecurityMock().init(authentication); MockTagAttribute myVariableTagAttribute = new MockTagAttribute("myVariable"); getJsfMock().getMockTagAttributes().getTagAttributes().put( "var", myVariableTagAttribute); getJsfMock().getMockTagAttributes().getTagAttributes().put( "ifAllGranted", new MockTagAttribute(Roles.ROLE_A)); FaceletContext mockFaceletContext = getJsfMock().getMockFaceletContext(); AuthorizeFaceletsTagHandler tag = new AuthorizeFaceletsTagHandler( getJsfMock().getMockTagConfig()); tag.apply(mockFaceletContext, null); assertThat(mockFaceletContext.getAttribute("myVariable")) .isEqualTo(Boolean.TRUE); }