本文整理汇总了Java中com.ibm.xsp.registry.FacesLibrary类的典型用法代码示例。如果您正苦于以下问题:Java FacesLibrary类的具体用法?Java FacesLibrary怎么用?Java FacesLibrary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FacesLibrary类属于com.ibm.xsp.registry包,在下文中一共展示了FacesLibrary类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initRegistryMaps
import com.ibm.xsp.registry.FacesLibrary; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void initRegistryMaps() {
XspRegistryManager xrm = XspRegistryManager.getManager();
Collection<String> pids = xrm.getRegistryProviderIds();
for (String id : pids) {
XspRegistryProvider curProv = xrm.getRegistryProvider(id);
FacesSharableRegistry curReg = curProv.getRegistry();
Collection<String> uris = curReg.getLocalNamespaceUris();
for (String curUri : uris) {
FacesLibrary fl = curReg.getLocalLibrary(curUri);
List<FacesDefinition> defsList = fl.getDefs();
for (FacesDefinition curDef : defsList) {
_reverseDefMap.put((Class<? extends UIComponent>) curDef.getJavaClass(), curDef);
if (curDef.isTag()) {
_reverseTagMap.put((Class<? extends UIComponent>) curDef.getJavaClass(), curDef.getTagName());
_tagMap.put(curDef.getTagName(), (Class<? extends UIComponent>) curDef.getJavaClass());
}
}
}
}
}
示例2: getTagsAndProps
import com.ibm.xsp.registry.FacesLibrary; //导入依赖的package包/类
/**
* @param registryToList
* @param fullRegistry
* (if registryToList contains non-tag defs that have no
* descendants in registryToList, but do have descendants in
* fullRegistry, those defs will be included in the listing.)
* @return
*/
public static List<Object[]> getTagsAndProps(FacesSharableRegistry registryToList, FacesSharableRegistry fullRegistry) {
List<String> tagsAndParents = getTagsAndUsedParents(registryToList, fullRegistry);
Collections.sort(tagsAndParents);
Map<String, FacesLibrary> prefixToNamespace = getPrefixToNamespace(fullRegistry);
List<Object[]> tagsAndProps = new ArrayList<Object[]>();
for (String prefixedName : tagsAndParents) {
FacesDefinition def = getDef(prefixToNamespace, prefixedName);
Collection<String> propNames = def.getDefinedPropertyNames();
if( propNames.isEmpty() ){
tagsAndProps.add(new Object[]{prefixedName, true});
continue;
}
Object[] tagAndProp = new Object[]{prefixedName, true, null};
List<String> sortedNames = new ArrayList<String>(propNames);
Collections.sort(sortedNames);
Object[] editedTag = withProps(tagAndProp, StringUtil.toStringArray(sortedNames));
tagsAndProps.add(editedTag);
}
return tagsAndProps;
}
示例3: getDef
import com.ibm.xsp.registry.FacesLibrary; //导入依赖的package包/类
/**
* @param prefixToNamespace
* @param prefixedName
* @return
*/
public static FacesDefinition getDef(
Map<String, FacesLibrary> prefixToNamespace, String prefixedName) {
// boolean isTag = prefixedName.contains(":");
String normalized = prefixedName.replace('-', ':');
String[] prefixAndName = normalized.split(":");
FacesLibrary lib = prefixToNamespace.get(prefixAndName[0]);
if( null == lib ){
throw new RuntimeException("Internal logic error, "
+ "prefix map does not contain prefix for "
+ prefixAndName[0]+", which should originally have come from that map.");
}
FacesDefinition def = lib.getDefinition(prefixAndName[1]);
if( null != def ){
return def;
}
for (FacesLibraryFragment file : lib.getFiles()) {
for (FacesDefinition fileDef : file.getDefs()) {
if( fileDef.getReferenceId().equals(prefixAndName[1]) ){
return fileDef;
}
}
}
return null;
}
示例4: filterToDependsLibrary
import com.ibm.xsp.registry.FacesLibrary; //导入依赖的package包/类
/**
* Note, calling them a depends library to distinguish from a namespace library.
* @param registry
* @param dependsLibraryId
* @param fullList
* @return
*/
public static List<Object[]> filterToDependsLibrary(FacesSharableRegistry registry, String dependsLibraryId, List<Object[]>fullList){
FacesSharableRegistry filterToReg = null;
for (FacesSharableRegistry depend : registry.getDepends()) {
if(dependsLibraryId.equals(depend.getId()) ){
filterToReg = depend;
break;
}
}
if( null == filterToReg ){
throw new IllegalArgumentException("Cannot find the library registry with ID: "+dependsLibraryId);
}
Map<String, FacesLibrary> prefixToNamespace = getPrefixToNamespace(registry);
List<FacesDefinition> libDefs = filterToReg.findLocalDefs();
List<Object[]> output = new ArrayList<Object[]>(libDefs.size());
for (Object[] fullListTagArr : fullList) {
String prefixedName = getName(fullListTagArr);
FacesDefinition fullListDef = getDef(prefixToNamespace, prefixedName);
if( libDefs.contains(fullListDef) ){
output.add(fullListTagArr);
}
}
return output;
}
示例5: getPrefixToNamespace
import com.ibm.xsp.registry.FacesLibrary; //导入依赖的package包/类
/**
* @param registry
* @return
*/
public static Map<String, FacesLibrary> getPrefixToNamespace(
FacesRegistry registry) {
Map<String, FacesLibrary> prefixToNamespace = new HashMap<String, FacesLibrary>();
for (String namespace : registry.getNamespaceUris()) {
FacesLibrary lib = registry.getLibrary(namespace);
String prefix = lib.getFirstDefaultPrefix();
prefixToNamespace.put(prefix, lib);
}
return prefixToNamespace;
}
示例6: getTagsAndUsedParents
import com.ibm.xsp.registry.FacesLibrary; //导入依赖的package包/类
private static List<String> getTagsAndUsedParents(FacesSharableRegistry registryToList, FacesSharableRegistry fullRegistry) {
String parentTag = "is-used-non-tag-parent";
markUsedNonTagParents(fullRegistry, parentTag);
List<String> tagsAndParents = new ArrayList<String>();
for (String namespace : registryToList.getNamespaceUris()) {
FacesLibrary namespaceLib = registryToList.getLibrary(namespace);
String prefix = namespaceLib.getFirstDefaultPrefix();
for (FacesDefinition def : namespaceLib.getDefs()) {
if( ! (def instanceof FacesComplexDefinition || def instanceof FacesComponentDefinition)){
continue;
}
String name = prefix + ":" + def.getTagName();
if( ! def.isTag() ){
boolean isCustomControlBase = "com.ibm.xsp.IncludeComposite".equals(def.getReferenceId());
if( null != def.getExtension(parentTag) ){
// non-tag that is ancestor of something in fullRegistry
name = prefix + "-"+def.getId();
}else if( isCustomControlBase ){
// UIIncludeComposite is actually used, even though it doesn't
// have a tag-name; it's the parent to all the custom controls.
name = prefix + "-"+def.getId();
}else{
continue;
}
}
if( tagsAndParents.contains(name) ){
throw new RuntimeException("More than 1 parent control named "+name);
}
tagsAndParents.add(name);
}
}
return tagsAndParents;
}
示例7: checkSinceVersion
import com.ibm.xsp.registry.FacesLibrary; //导入依赖的package包/类
private String checkSinceVersion(FacesRegistry reg,
Map<String, FacesLibrary> libByPrefix, Object[][] tagsAndProps, String expectedSince) {
String fails = "";
for (Object[] tagAndProp : tagsAndProps) {
String prefixedTagName = getName(tagAndProp);
FacesDefinition def = PrintTagNamesAndProps.getDef(libByPrefix, prefixedTagName);
if( null == def ){
fails+= prefixedTagName+" not found. Expected <since>"+expectedSince+"<\n";
continue;
}
String actualDefSince = def.getSince();
boolean isNewTag = PrintTagNamesAndProps.isNewTag(tagAndProp);
if( isNewTag && !StringUtil.equals(expectedSince, actualDefSince) ){
fails += XspTestUtil.loc(def) + " bad since version. Expected <since>"
+ expectedSince + "<, was <since>" + actualDefSince
+ "<\n";
continue;
}
if( isNoProps(tagAndProp) ){
continue;
}
String[] propNames = getProps(tagAndProp);
for (String name : propNames) {
FacesProperty prop = def.getProperty(name);
if( null == prop ){
String msg = XspTestUtil.loc(def)+" " +name+" not found. Expected <since>"+expectedSince+"<";
fails+= msg + "\n";
continue;
}
String actualPropSince = prop.getSince();
if( null == actualPropSince ){
actualPropSince = actualDefSince;
}
if( ! StringUtil.equals(expectedSince, actualPropSince) ){
fails += XspTestUtil.loc(def) +" " +name+ " bad since version. Expected <since>"
+ expectedSince + "<, was <since>" + actualPropSince
+ "<\n";
continue;
}
}
}
return fails;
}