Search in sources :

Example 21 with LayoutTplElement

use of com.liferay.ide.layouttpl.core.model.LayoutTplElement in project liferay-ide by liferay.

the class LayoutTplTestsBootstrap method testPortletColumnWeightInitialValueService.

@Test
public void testPortletColumnWeightInitialValueService() throws Exception {
    final LayoutTplElement layoutTpl = LayoutTplElement.TYPE.instantiate();
    layoutTpl.setBootstrapStyle(true);
    final PortletLayoutElement row = layoutTpl.getPortletLayouts().insert();
    final ElementList<PortletColumnElement> columns = row.getPortletColumns();
    columns.insert();
    columns.insert();
    columns.insert();
    columns.insert();
    assertEquals(6, columns.get(0).getWeight().content().intValue());
    assertEquals(3, columns.get(1).getWeight().content().intValue());
    assertEquals(2, columns.get(2).getWeight().content().intValue());
    assertEquals(1, columns.get(3).getWeight().content().intValue());
    columns.get(0).setWeight(2);
    columns.get(1).setWeight(2);
    columns.get(2).setWeight(2);
    columns.get(3).setWeight(2);
    columns.insert();
    assertEquals(4, columns.get(4).getWeight().content().intValue());
}
Also used : PortletLayoutElement(com.liferay.ide.layouttpl.core.model.PortletLayoutElement) PortletColumnElement(com.liferay.ide.layouttpl.core.model.PortletColumnElement) LayoutTplElement(com.liferay.ide.layouttpl.core.model.LayoutTplElement) Test(org.junit.Test)

Aggregations

LayoutTplElement (com.liferay.ide.layouttpl.core.model.LayoutTplElement)21 PortletColumnElement (com.liferay.ide.layouttpl.core.model.PortletColumnElement)10 PortletLayoutElement (com.liferay.ide.layouttpl.core.model.PortletLayoutElement)9 Test (org.junit.Test)7 IFile (org.eclipse.core.resources.IFile)5 Element (org.eclipse.sapphire.Element)3 Status (org.eclipse.sapphire.modeling.Status)2 ValidationService (org.eclipse.sapphire.services.ValidationService)2 LayoutTplDescriptorHelper (com.liferay.ide.layouttpl.core.operation.LayoutTplDescriptorHelper)1 IOException (java.io.IOException)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 Event (org.eclipse.sapphire.Event)1 Listener (org.eclipse.sapphire.Listener)1 Property (org.eclipse.sapphire.Property)1 Value (org.eclipse.sapphire.Value)1 IDataModel (org.eclipse.wst.common.frameworks.datamodel.IDataModel)1 IModelStateListener (org.eclipse.wst.sse.core.internal.provisional.IModelStateListener)1