本文整理汇总了Java中org.apache.deltaspike.jsf.api.config.view.View类的典型用法代码示例。如果您正苦于以下问题:Java View类的具体用法?Java View怎么用?Java View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
View类属于org.apache.deltaspike.jsf.api.config.view包,在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: contextInitialized
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent sce)
{
if (ClassDeactivationUtils.isActivated(getClass()))
{
ViewConfigResolver viewConfigResolver;
try
{
viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class);
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Container issue detected -> can't validate view-configs. " +
"This exception is usually the effect (but not the reason) of a failed startup. " +
"You can deactivate " + getClass().getName() + " via a custom " +
ClassDeactivator.class.getName() + " to verify it.", e);
return;
}
List<String> supportedExtensions = new ArrayList<String>();
supportedExtensions.add(View.Extension.XHTML);
supportedExtensions.add(View.Extension.JSP);
validateViewConfigPaths(sce, viewConfigResolver, supportedExtensions);
}
}
示例2: validateAnnotationChange
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
protected void validateAnnotationChange(Annotation annotation)
{
Class<? extends Annotation> annotationType = annotation.annotationType();
if (Folder.class.equals(annotationType) || View.class.equals(annotationType))
{
return;
}
ViewMetaData viewMetaData = annotationType.getAnnotation(ViewMetaData.class);
if (viewMetaData == null)
{
return;
}
Aggregated aggregated = viewMetaData.annotationType().getAnnotation(Aggregated.class);
if (aggregated != null && aggregated.value())
{
throw new IllegalStateException("it isn't supported to change aggregated meta-data," +
"because inheritance won't work correctly");
}
}
示例3: testValidViewConfig
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test
public void testValidViewConfig()
{
this.viewConfigExtension.addPageDefinition(Pages.Index.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
List<String> supportedExtensions = new ArrayList<String>();
supportedExtensions.add(View.Extension.XHTML);
try
{
new MockedViewConfigPathValidator(true).validateViewConfigPaths(null, viewConfigResolver, supportedExtensions);
}
catch (Exception e)
{
Assert.fail("valid view-config was reported as invalid");
}
}
示例4: testMissingPathButUnsupportedExtension
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test
public void testMissingPathButUnsupportedExtension()
{
this.viewConfigExtension.addPageDefinition(Pages.Index.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
List<String> supportedExtensions = new ArrayList<String>();
supportedExtensions.add(View.Extension.JSF);
try
{
new MockedViewConfigPathValidator(false).validateViewConfigPaths(null, viewConfigResolver, supportedExtensions);
}
catch (Exception e)
{
Assert.fail("unsupported extension wasn't ignored");
}
}
示例5: testSimpleViewConfigWithExplicitPageMetaData
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test
public void testSimpleViewConfigWithExplicitPageMetaData()
{
this.viewConfigExtension.addPageDefinition(SimplePageConfig002.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig002.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/simplePageConfig002.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(SimplePageConfig002.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
}
示例6: testSimpleViewConfigWithOptionalPageMetaData
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test
public void testSimpleViewConfigWithOptionalPageMetaData()
{
this.viewConfigExtension.addPageDefinition(SimplePageConfig001.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(SimplePageConfig001.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertEquals("/simplePageConfig001.xhtml", viewConfigDescriptor.getViewId());
Assert.assertEquals(SimplePageConfig001.class, viewConfigDescriptor.getConfigClass());
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
//@View gets added autom. if it isn't provided in-/directly
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
}
示例7: testInvalidBasePathUsage
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test
public void testInvalidBasePathUsage()
{
this.viewConfigExtension.addPageDefinition(PagesViolation.Wizard1.Start.class);
try
{
this.viewConfigResolverProducer.createViewConfigResolver();
}
catch (IllegalStateException e)
{
if (!(e.getMessage().contains(View.class.getName()) &&
e.getMessage().contains(Folder.class.getName())&&
e.getMessage().contains("#basePath")))
{
Assert.fail("unexpected violation message found");
}
return;
}
Assert.fail("violation not found");
}
示例8: testMetaDataTreeCustomViewConfigPreProcessor
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test
public void testMetaDataTreeCustomViewConfigPreProcessor()
{
this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);
ViewConfigNode node = this.viewConfigExtension.findNode(Pages.Public.Index.class);
Assert.assertNotNull(node);
Assert.assertNotNull(node.getParent());
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNotNull(node.getParent().getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent().getParent());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.class, node.getMetaData().iterator().next().annotationType());
Assert.assertEquals(View.ViewParameterMode.INCLUDE, ((View)node.getMetaData().iterator().next()).viewParams());
}
示例9: convertEntryToOutcome
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
private String convertEntryToOutcome(ExternalContext externalContext, ViewConfigDescriptor entry)
{
View viewMetaData = entry.getMetaData(View.class).iterator().next();
boolean performRedirect = View.NavigationMode.REDIRECT.equals(viewMetaData.navigation());
boolean includeViewParameters = View.ViewParameterMode.INCLUDE.equals(viewMetaData.viewParams());
StringBuilder result = new StringBuilder(entry.getViewId());
if (performRedirect)
{
result.append("?faces-redirect=true");
}
if (includeViewParameters)
{
if (performRedirect)
{
result.append("&");
}
else
{
result.append("?");
}
result.append("includeViewParams=true");
return JsfUtils.addPageParameters(externalContext, result.toString(), false);
}
return result.toString();
}
示例10: getFinalMetaDataFromNode
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
private Annotation getFinalMetaDataFromNode(ViewConfigNode viewConfigNode, Annotation annotation)
{
Class<? extends Annotation> targetType = annotation.annotationType();
//skip @View and @Folder, because they get created dynamically to support their optional usage
//the dynamic generation depends on the level and if it is a synthetic information
if (View.class.equals(targetType) || Folder.class.equals(targetType))
{
return annotation;
}
//skip aggregated meta-data, because it can't be replaced
//(there is no info available about the instance which replaced the original one
// which might be equivalent to the annotation passed to this method)
ViewMetaData viewMetaData = annotation.annotationType().getAnnotation(ViewMetaData.class);
if (viewMetaData == null)
{
return annotation;
}
Aggregated aggregated = viewMetaData.annotationType().getAnnotation(Aggregated.class);
if (aggregated == null || aggregated.value())
{
return annotation;
}
for (Annotation nodeMetaData : viewConfigNode.getMetaData())
{
if (targetType.equals(nodeMetaData.annotationType()))
{
return nodeMetaData;
}
}
return annotation;
}
示例11: convert
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Override
public ConfigDescriptor convert(ViewConfigNode node)
{
List<Annotation> mergedMetaData = mergeMetaData(node.getMetaData(), node.getInheritedMetaData());
//e.g. replace default placeholders needed for the merge with real default values
mergedMetaData = preProcessMetaData(mergedMetaData, node);
Class sourceClass = node.getSource();
if (ViewConfigUtils.isFolderConfig(sourceClass))
{
Folder folderAnnotation = findMetaDataByType(mergedMetaData, Folder.class);
return new DefaultFolderConfigDescriptor(folderAnnotation.name(), node.getSource(),
mergedMetaData, node.getCallbackDescriptors());
}
else if (ViewConfig.class.isAssignableFrom(sourceClass))
{
View viewAnnotation = findMetaDataByType(mergedMetaData, View.class);
String viewId = viewAnnotation.basePath() + viewAnnotation.name() + "." + viewAnnotation.extension();
return new DefaultViewPathConfigDescriptor(viewId, node.getSource(),
filterInheritedFolderMetaData(mergedMetaData), node.getCallbackDescriptors());
}
else
{
throw new IllegalStateException(node.getSource() + " isn't a valid view-config");
}
}
示例12: testMissingPath
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testMissingPath()
{
this.viewConfigExtension.addPageDefinition(Pages.Index.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
List<String> supportedExtensions = new ArrayList<String>();
supportedExtensions.add(View.Extension.XHTML);
new MockedViewConfigPathValidator(false).validateViewConfigPaths(null, viewConfigResolver, supportedExtensions);
}
示例13: testViewConfigWithStereotypeMetaData
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test
public void testViewConfigWithStereotypeMetaData()
{
this.viewConfigExtension.addPageDefinition(Pages.Home.class);
this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Home.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Public.Index.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
}
示例14: testViewConfigWithStereotypeMetaData
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test
public void testViewConfigWithStereotypeMetaData()
{
this.viewConfigExtension.addPageDefinition(Pages.Home.class);
this.viewConfigExtension.addPageDefinition(Pages.Public.Index.class);
ViewConfigResolver viewConfigResolver = this.viewConfigResolverProducer.createViewConfigResolver();
ViewConfigDescriptor viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Home.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(2, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(MyView.class).size());
Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.INCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
Assert.assertEquals("landing page", viewConfigDescriptor.getMetaData(MyView.class).iterator().next().description());
viewConfigDescriptor = viewConfigResolver.getViewConfigDescriptor(Pages.Public.Index.class);
Assert.assertNotNull(viewConfigDescriptor);
Assert.assertNotNull(viewConfigDescriptor.getMetaData());
Assert.assertEquals(2, viewConfigDescriptor.getMetaData().size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(View.class).size());
Assert.assertEquals(1, viewConfigDescriptor.getMetaData(MyView.class).size());
Assert.assertEquals(View.NavigationMode.REDIRECT, viewConfigDescriptor.getMetaData(View.class).iterator().next().navigation());
Assert.assertEquals(View.ViewParameterMode.EXCLUDE, viewConfigDescriptor.getMetaData(View.class).iterator().next().viewParams());
Assert.assertEquals("public content", viewConfigDescriptor.getMetaData(MyView.class).iterator().next().description());
}
示例15: testDuplicatedNavigationTargetsInMetaDataTree
import org.apache.deltaspike.jsf.api.config.view.View; //导入依赖的package包/类
@Test
public void testDuplicatedNavigationTargetsInMetaDataTree()
{
this.viewConfigExtension.addPageDefinition(PagesViolation.Index.class);
this.viewConfigExtension.addPageDefinition(PagesViolation.Overview.class);
ViewConfigNode node = this.viewConfigExtension.findNode(PagesViolation.Index.class);
Assert.assertNotNull(node);
Assert.assertNotNull(node.getParent());
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(0, node.getMetaData().size());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
node = this.viewConfigExtension.findNode(PagesViolation.Overview.class);
Assert.assertNotNull(node);
Assert.assertNotNull(node.getParent());
Assert.assertNotNull(node.getParent().getParent());
Assert.assertNull(node.getParent().getParent().getParent());
Assert.assertNotNull(node.getChildren());
Assert.assertEquals(0, node.getChildren().size());
Assert.assertNotNull(node.getMetaData());
Assert.assertEquals(1, node.getMetaData().size());
Assert.assertEquals(View.class, node.getMetaData().iterator().next().annotationType());
Assert.assertNotNull(node.getInheritedMetaData());
Assert.assertEquals(0, node.getInheritedMetaData().size());
}