Search in sources :

Example 16 with PageRegions

use of com.enonic.xp.page.PageRegions in project xp by enonic.

the class ComponentInstructionTest method createPage.

private Content createPage(final String id, final String name, final String contentTypeName) {
    PropertyTree rootDataSet = new PropertyTree();
    rootDataSet.addString("property1", "value1");
    Region region = Region.create().name("myRegion").add(PartComponent.create().descriptor(DescriptorKey.from("myapplication:myparttemplate")).build()).build();
    PageRegions pageRegions = PageRegions.create().add(region).build();
    Page page = Page.create().template(PageTemplateKey.from("my-page")).regions(pageRegions).build();
    return Content.create().id(ContentId.from(id)).path(ContentPath.from(name)).owner(PrincipalKey.from("user:myStore:me")).displayName("My Content").modifier(PrincipalKey.from("user:system:admin")).type(ContentTypeName.from(contentTypeName)).page(page).build();
}
Also used : PageRegions(com.enonic.xp.page.PageRegions) PropertyTree(com.enonic.xp.data.PropertyTree) Region(com.enonic.xp.region.Region) Page(com.enonic.xp.page.Page)

Example 17 with PageRegions

use of com.enonic.xp.page.PageRegions in project xp by enonic.

the class RenderBaseHandlerTest method createPageTemplate.

private PageTemplate createPageTemplate() {
    final PropertyTree pageTemplateConfig = new PropertyTree();
    pageTemplateConfig.addLong("pause", 10000L);
    PageRegions pageRegions = PageRegions.create().add(Region.create().name("main-region").add(PartComponent.create().descriptor("myapp:mypart").build()).build()).build();
    final PageTemplate.Builder builder = PageTemplate.newPageTemplate().key(PageTemplateKey.from("abc")).canRender(ContentTypeNames.from("myapplication:article", "myapplication:banner", "myapplication:ctype")).regions(pageRegions).config(pageTemplateConfig);
    builder.controller(DescriptorKey.from("mainapplication:landing-page"));
    builder.displayName("Main page template");
    builder.name("main-page-template");
    builder.parentPath(ContentPath.ROOT);
    return builder.build();
}
Also used : PageRegions(com.enonic.xp.page.PageRegions) PageTemplate(com.enonic.xp.page.PageTemplate) PropertyTree(com.enonic.xp.data.PropertyTree)

Aggregations

PageRegions (com.enonic.xp.page.PageRegions)17 PropertyTree (com.enonic.xp.data.PropertyTree)9 Page (com.enonic.xp.page.Page)8 Content (com.enonic.xp.content.Content)6 Test (org.junit.jupiter.api.Test)6 Region (com.enonic.xp.region.Region)3 DescriptorKey (com.enonic.xp.page.DescriptorKey)1 PageDescriptor (com.enonic.xp.page.PageDescriptor)1 PageTemplate (com.enonic.xp.page.PageTemplate)1 RenderException (com.enonic.xp.portal.impl.rendering.RenderException)1 Component (com.enonic.xp.region.Component)1 LayoutComponent (com.enonic.xp.region.LayoutComponent)1 PartComponent (com.enonic.xp.region.PartComponent)1 RegionDescriptors (com.enonic.xp.region.RegionDescriptors)1