use of com.liferay.ide.layouttpl.core.operation.NewLayoutTplDataModelProvider in project liferay-ide by liferay.
the class NewLayoutTplWizard method getDefaultProvider.
@Override
protected IDataModelProvider getDefaultProvider() {
LayoutTplUI defaultUI = LayoutTplUI.getDefault();
TemplateStore templateStore = defaultUI.getTemplateStore();
ContextTypeRegistry contextTypeRegistry = defaultUI.getTemplateContextRegistry();
TemplateContextType contextType = contextTypeRegistry.getContextType(LayoutTplTemplateContextTypeIds.NEW);
return new NewLayoutTplDataModelProvider() {
@Override
public IDataModelOperation getDefaultOperation() {
return new AddLayoutTplOperation(getDataModel(), templateStore, contextType);
}
};
}
use of com.liferay.ide.layouttpl.core.operation.NewLayoutTplDataModelProvider in project liferay-ide by liferay.
the class NewLiferayPluginProjectOp625Tests method testNewLayoutAntProject.
@Override
@Test
public void testNewLayoutAntProject() throws Exception {
if (shouldSkipBundleTests())
return;
String projectName = "test-layouttpl-project-sdk";
NewLiferayPluginProjectOp op = newProjectOp(projectName);
op.setPluginType(PluginType.layouttpl);
IProject layouttplProject = createAntProject(op);
IFolder webappRoot = LiferayCore.create(IWebProject.class, layouttplProject).getDefaultDocrootFolder();
assertNotNull(webappRoot);
IFile layoutXml = webappRoot.getFile("WEB-INF/liferay-layout-templates.xml");
assertEquals(true, layoutXml.exists());
IFile wapTpl = webappRoot.getFile("test_layouttpl_project_sdk_6.2.5.wap.tpl");
assertTrue(wapTpl.exists());
IDataModel model = DataModelFactory.createDataModel(new NewLayoutTplDataModelProvider());
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_ID, "newtemplate");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_NAME, "New Template");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_THUMBNAIL_FILE, "/newtemplate.png");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_WAP_TEMPLATE_FILE, "/newtemplate.wap.tpl");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_FILE, "/newtemplate.tpl");
LayoutTplDescriptorHelper layoutHelper = new LayoutTplDescriptorHelper(layouttplProject);
layoutHelper.addNewLayoutTemplate(model);
String contents = CoreUtil.readStreamToString(layoutXml.getContents(true));
assertTrue(contents.contains("<wap-template-path>"));
}
use of com.liferay.ide.layouttpl.core.operation.NewLayoutTplDataModelProvider in project liferay-ide by liferay.
the class NewLiferayPluginProjectOp7sp3Tests method testNewLayoutAntProject.
@Override
@Test
public void testNewLayoutAntProject() throws Exception {
String projectName = "test-layouttpl-project-sdk";
NewLiferayPluginProjectOp op = newProjectOp(projectName);
op.setPluginType(PluginType.layouttpl);
IProject layouttplProject = createAntProject(op);
IFolder webappRoot = LiferayCore.create(IWebProject.class, layouttplProject).getDefaultDocrootFolder();
assertNotNull(webappRoot);
IFile layoutXml = webappRoot.getFile("WEB-INF/liferay-layout-templates.xml");
assertEquals(true, layoutXml.exists());
IFile wapTpl = webappRoot.getFile("test_layouttpl_project_sdk_7.0.2.wap.tpl");
assertFalse(wapTpl.exists());
IDataModel model = DataModelFactory.createDataModel(new NewLayoutTplDataModelProvider());
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_ID, "newtemplate");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_NAME, "New Template");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_THUMBNAIL_FILE, "/newtemplate.png");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_WAP_TEMPLATE_FILE, "/newtemplate.wap.tpl");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_FILE, "/newtemplate.tpl");
LayoutTplDescriptorHelper layoutHelper = new LayoutTplDescriptorHelper(layouttplProject);
layoutHelper.addNewLayoutTemplate(model);
String contents = CoreUtil.readStreamToString(layoutXml.getContents(true));
assertFalse(contents.contains("<wap-template-path>"));
}
use of com.liferay.ide.layouttpl.core.operation.NewLayoutTplDataModelProvider in project liferay-ide by liferay.
the class NewLiferayPluginProjectOp701Tests method testNewLayoutAntProject.
@Override
@Test
public void testNewLayoutAntProject() throws Exception {
String projectName = "test-layouttpl-project-sdk";
NewLiferayPluginProjectOp op = newProjectOp(projectName);
op.setPluginType(PluginType.layouttpl);
IProject layouttplProject = createAntProject(op);
IFolder webappRoot = LiferayCore.create(IWebProject.class, layouttplProject).getDefaultDocrootFolder();
assertNotNull(webappRoot);
IFile layoutXml = webappRoot.getFile("WEB-INF/liferay-layout-templates.xml");
assertEquals(true, layoutXml.exists());
IFile wapTpl = webappRoot.getFile("test_layouttpl_project_sdk_7.0.2.wap.tpl");
assertFalse(wapTpl.exists());
IDataModel model = DataModelFactory.createDataModel(new NewLayoutTplDataModelProvider());
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_ID, "newtemplate");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_NAME, "New Template");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_THUMBNAIL_FILE, "/newtemplate.png");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_WAP_TEMPLATE_FILE, "/newtemplate.wap.tpl");
model.setProperty(INewLayoutTplDataModelProperties.LAYOUT_TEMPLATE_FILE, "/newtemplate.tpl");
LayoutTplDescriptorHelper layoutHelper = new LayoutTplDescriptorHelper(layouttplProject);
layoutHelper.addNewLayoutTemplate(model);
String contents = CoreUtil.readStreamToString(layoutXml.getContents(true));
assertFalse(contents.contains("<wap-template-path>"));
}
Aggregations