javax.faces.component.visit.VisitCallback Java Examples
The following examples show how to use
javax.faces.component.visit.VisitCallback.
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: TabRepeat.java From BootsFaces-OSP with Apache License 2.0 | 5 votes |
private boolean visitChildren(VisitContext context, VisitCallback callback) { Integer begin = this.getBegin(); Integer end = this.getEnd(); Integer step = this.getStep(); int rowCount = getDataModel().getRowCount(); int i = ((begin != null) ? begin : 0); int e = ((end != null) ? end : rowCount); int s = ((step != null) ? step : 1); validateIterationControlValues(rowCount, i, e); FacesContext faces = context.getFacesContext(); this.setIndex(faces, i); this.updateIterationStatus(faces, new IterationStatus(true, (i + s > e || rowCount == 1), i, begin, end, step)); while (i < e && this.isIndexAvailable()) { this.setIndex(faces, i); this.updateIterationStatus(faces, new IterationStatus(false, i + s >= e, i, begin, end, step)); for (UIComponent kid : getChildren()) { if (kid.visitTree(context, callback)) { return true; } } i += s; } return false; }
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: UIVarPublisherBase.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
@Override public boolean visitTree(VisitContext context, VisitCallback callback) { try { _shadowedData = publishControlData(context.getFacesContext()); return super.visitTree(context, callback); } finally { revokeControlData(_shadowedData, context.getFacesContext()); _shadowedData = null; } }
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; }