Java Code Examples for javax.faces.component.UIComponent#processDecodes()

The following examples show how to use javax.faces.component.UIComponent#processDecodes() . 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: AbstractDataView.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
protected void revokeControlData(List<ShadowedObject> shadowedObjects,
        FacesContext context) {
    if (null != processFacetsForPhase && ExtLibUtil.isXPages852()) {
        try {
            // workaround for SPR#MKEE8BFEDR: Repeat, input values in header
            // are not processed when submitted.
            if (getFacetCount() > 0) {
                int phaseOrdinal = processFacetsForPhase.getOrdinal();
                for (UIComponent facet : TypedUtil.getFacets(this).values()) {
                    if (!facet.isRendered()) {
                        continue;
                    }
                    if (phaseOrdinal == PhaseId.APPLY_REQUEST_VALUES
                            .getOrdinal()) {
                        facet.processDecodes(context);
                        continue;
                    }
                    if (phaseOrdinal == PhaseId.UPDATE_MODEL_VALUES
                            .getOrdinal()) {
                        facet.processUpdates(context);
                        continue;
                    }
                    if (phaseOrdinal == PhaseId.PROCESS_VALIDATIONS
                            .getOrdinal()) {
                        facet.processValidators(context);
                        continue;
                    }
                }
            }
        }
        finally {
            processFacetsForPhase = null;
        }
    }
    super.revokeControlData(shadowedObjects, context);
}
 
Example 2
Source File: UISwitchFacet.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public void processDecodes(FacesContext context) {
    if (!isRendered()) {
        return;
    }
	UIComponent facet = selectFacet(); 
	if(facet!=null) {
		try {
    		facet.processDecodes(context);
		} finally {
        	unselectFacet();
		}
    }
    decode(context);
}
 
Example 3
Source File: UIDataRepeater.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void processDecodes(FacesContext context) {
    int first = getFirst();
    int rows = getRows();
    int last;

    if (rows == 0) {
        last = getRowCount();
    } else {
        last = first + rows;
    }

    for (int rowIndex = first; rowIndex < last; rowIndex++) {
        setRowIndex(rowIndex);
        if (isRowAvailable()) {
            for (Iterator it = getChildren().iterator(); it.hasNext();) {
                UIComponent child = (UIComponent) it.next();
                // For some reason its necessary to touch Id property,
                // otherwise the child control will not call getClientId
                // on
                // parent (NamingContainer)
                child.setId(child.getId());
                if (!child.isRendered()) {
                    continue;
                }
                child.processDecodes(context);
            }
        }
    }

    setRowIndex(-1);

    super.processDecodes(context);
}
 
Example 4
Source File: RegisteredDecodeTest.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
public void testDecodeRegisteredComponents() throws Exception {
    
    String fails = "";

    TestProject.createRegistry(this);
    FacesSharableRegistry registry = TestProject.getRegistry(this);
    String libraryId = ConfigUtil.getTargetLibrary(this);
    List<FacesComponentDefinition> tags = findLibraryTags(registry, libraryId);
    
    // the config.properties says there there are no controls in the library
    // but some were found. Or the config.properties says there are controls
    // in the library, but none were found.
    boolean expectNoControls = ConfigUtil.isLibraryNoControls(this);
    assertEquals("Controls in library? mismatch ", expectNoControls, tags.isEmpty());
    if( tags.isEmpty() ){
        // no control tags to test.
        return;
    }
    
    
    // create an empty view
    FacesContext context = TestProject.createFacesContext(this);
    UIViewRoot root = TestProject.loadEmptyPage(this, context);
    List<UIComponent> children = TypedUtil.getChildren(root);
    children.clear();
    
    for (FacesComponentDefinition def : tags) {
        try{
            UIComponent component = (UIComponent) def.getJavaClass().newInstance();
            component.processDecodes(context);
        }catch(Exception ex){
            fails += XspTestUtil.loc(def)+" decode() throws: "+ex+"\n";
            ex.printStackTrace();
        }
    }
    fails = XspTestUtil.removeMultilineFailSkips(fails, 
            SkipFileContent.concatSkips(getSkips(), this, "testDecodeRegisteredComponents"));
    if( fails.length() > 0 ){
        fail(XspTestUtil.getMultilineFailMessage(fails));
    }
}