use of com.enonic.xp.region.Region in project xp by enonic.
the class ComponentMapper method serialize.
private void serialize(final MapGenerator gen, final LayoutComponent comp) {
gen.map(REGIONS);
for (final Region region : comp.getRegions()) {
new RegionMapper(region).serialize(gen);
}
gen.end();
}
use of com.enonic.xp.region.Region in project xp by enonic.
the class ProjectContentEventListenerTest method createPage.
private Page createPage() {
PropertyTree componentConfig = new PropertyTree();
componentConfig.setString("my-prop", "value");
PartComponent component = PartComponent.create().descriptor(DescriptorKey.from("mainapplication:partTemplateName")).config(componentConfig).build();
Region region = Region.create().name("my-region").add(component).build();
PageRegions regions = PageRegions.create().add(region).build();
PropertyTree pageConfig = new PropertyTree();
pageConfig.setString("background-color", "blue");
Mockito.when(partDescriptorService.getByKey(DescriptorKey.from("mainapplication:partTemplateName"))).thenReturn(PartDescriptor.create().key(DescriptorKey.from("mainapplication:partTemplateName")).displayName("my-component").config(Form.create().build()).build());
return Page.create().template(PageTemplateKey.from("mypagetemplate")).regions(regions).build();
}
use of com.enonic.xp.region.Region in project xp by enonic.
the class TestDataFixtures method createLayoutComponent.
private static LayoutComponent createLayoutComponent() {
final Region region1 = Region.create().name("left").add(PartComponent.create().build()).add(TextComponent.create().text("text text text").build()).add(TextComponent.create().build()).build();
final Region region2 = Region.create().name("right").add(createImageComponent("image-id", "Some Image", null)).add(createFragmentComponent("213sda-ss222", "My Fragment")).build();
final LayoutRegions layoutRegions = LayoutRegions.create().add(region1).add(region2).build();
return LayoutComponent.create().descriptor("layoutDescriptor:name").regions(layoutRegions).build();
}
use of com.enonic.xp.region.Region in project xp by enonic.
the class PortalUrlServiceImpl_componentUrlTest method addComponent.
private void addComponent() {
final PartComponent component = PartComponent.create().descriptor("myapp:mycomp").build();
final Region region = Region.create().name("main").add(component).build();
this.portalRequest.setComponent(component);
}
use of com.enonic.xp.region.Region in project xp by enonic.
the class PageTest method equals.
@Test
public void equals() {
final PropertyTree config1 = new PropertyTree();
config1.addString("some", "config");
final PropertyTree config2 = new PropertyTree();
config2.addString("other", "config");
final Region region1 = Region.create().name("main").add(PartComponent.create().descriptor("descriptor-x").config(new PropertyTree()).build()).add(PartComponent.create().descriptor("descriptor-y").config(new PropertyTree()).build()).build();
final Region region2 = Region.create().name("apart").add(PartComponent.create().descriptor("descriptor-x").config(new PropertyTree()).build()).add(PartComponent.create().descriptor("descriptor-y").config(new PropertyTree()).build()).build();
AbstractEqualsTest equalsTest = new AbstractEqualsTest() {
@Override
public Object getObjectX() {
return Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).build()).build();
}
@Override
public Object[] getObjectsThatNotEqualsX() {
Page notX1 = Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region2).build()).build();
Page notX2 = Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).add(region2).build()).build();
Page notX3 = Page.create().config(config2).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).build()).build();
Page notX4 = Page.create().config(config1).template(PageTemplateKey.from("template-y")).regions(PageRegions.create().add(region1).build()).build();
return new Object[] { notX1, notX2, notX3, notX4, new Object() };
}
@Override
public Object getObjectThatEqualsXButNotTheSame() {
return Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).build()).build();
}
@Override
public Object getObjectThatEqualsXButNotTheSame2() {
return Page.create().config(config1).template(PageTemplateKey.from("template-x")).regions(PageRegions.create().add(region1).build()).build();
}
};
equalsTest.assertEqualsAndHashCodeContract();
}
Aggregations