javax.faces.component.visit.VisitResult Java Examples
The following examples show how to use
javax.faces.component.visit.VisitResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResetInputAjaxActionListener.java From ctsms with GNU Lesser General Public License v2.1 | 6 votes |
@Override public VisitResult visit(VisitContext context, UIComponent target) { FacesContext facesContext = context.getFacesContext(); Collection<String> executeIds = facesContext.getPartialViewContext().getExecuteIds(); if (executeIds.contains(target.getClientId(facesContext))) { return VisitResult.REJECT; } if (target instanceof EditableValueHolder) { ((EditableValueHolder) target).resetValue(); } else if (context.getIdsToVisit() != VisitContext.ALL_IDS) { // Render ID didn't specifically point an EditableValueHolder. Visit all children as well. if (!SKIP_COMPONENTS.contains(target.getClass())) { try { target.visitTree(createVisitContext(facesContext, null, context.getHints()), VISIT_CALLBACK); } catch (Exception e) { } } } return VisitResult.ACCEPT; }
Example #2
Source File: UISwitchFacet.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
@Override public boolean visitTree(VisitContext context, VisitCallback callback) { if (!isVisitable(context)) { return false; } // Check for the current component VisitResult res = context.invokeVisitCallback(this, callback); if (res == VisitResult.COMPLETE) return true; if (res == VisitResult.ACCEPT) { // we should visit the children if we have ids (all or selected) to visit boolean visitChildren = !context.getSubtreeIdsToVisit(this).isEmpty(); if (visitChildren) { // visit the component facets UIComponent facet = selectFacet(); if(facet!=null) { try { if(facet.visitTree(context, callback)) { return true; } } finally { unselectFacet(); } } } } return false; }
Example #3
Source File: PhaseListenerBean.java From tutorials with MIT License | 5 votes |
private void processComponentTree(UIComponent component, PhaseEvent event, boolean show) { component.visitTree(VisitContext.createVisitContext(event.getFacesContext()), (context, target) -> { if (target.getId() != null && target.getId().startsWith("new-feature-") && !show) { target.setRendered(false); } return VisitResult.ACCEPT; }); }
Example #4
Source File: TabRepeat.java From BootsFaces-OSP with Apache License 2.0 | 4 votes |
@Override public boolean visitTree(VisitContext context, VisitCallback callback) { if (this.getVar() == null) { return super.visitTree(context, callback); } // First check to see whether we are visitable. If not // short-circuit out of this subtree, though allow the // visit to proceed through to other subtrees. if (!isVisitable(context)) { return false; } FacesContext facesContext = context.getFacesContext(); boolean visitRows = requiresRowIteration(context); int oldRowIndex = -1; if (visitRows) { oldRowIndex = getDataModel().getRowIndex(); setIndex(facesContext, -1); } this.setDataModel(null); // Push ourselves to EL pushComponentToEL(facesContext, null); try { // Visit ourselves. Note that we delegate to the // VisitContext to actually perform the visit. VisitResult result = context.invokeVisitCallback(this, callback); // If the visit is complete, short-circuit out and end the visit if (result == VisitResult.COMPLETE) { return true; } // Visit children, short-circuiting as necessary if ((result == VisitResult.ACCEPT) && doVisitChildren(context)) { // And finally, visit rows if (!visitRows) { // visit rows without model access for (UIComponent kid : getChildren()) { if (kid.visitTree(context, callback)) { return true; } } } else { if (visitChildren(context, callback)) { return true; } } } } finally { // Clean up - pop EL and restore old row index popComponentFromEL(facesContext); if (visitRows) { setIndex(facesContext, oldRowIndex); } } // Return false to allow the visit to continue return false; }