Search in sources :

Example 21 with PortletColumnElement

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

the class LayoutTplTestsBootstrap method evalTemplateFromChangedModel_1_3_2_nest_columns.

@Test
public void evalTemplateFromChangedModel_1_3_2_nest_columns() throws Exception {
    IFile refTplFile = getFileFromTplName("1_3_2_nest_changed_columns.tpl");
    final String className = convertToTplClassName("1_3_2_nest_changed_columns.tpl");
    final LayoutTplElement layoutTpl = createModel_132_nest(isBootstrapStyle(), className, is62());
    final PortletLayoutElement row1 = (PortletLayoutElement) layoutTpl.getPortletLayouts().get(0);
    final PortletLayoutElement row2 = (PortletLayoutElement) layoutTpl.getPortletLayouts().get(1);
    final PortletLayoutElement row3 = (PortletLayoutElement) layoutTpl.getPortletLayouts().get(2);
    final PortletLayoutElement row311 = row3.getPortletColumns().get(0).getPortletLayouts().get(0);
    final PortletLayoutElement row312 = row3.getPortletColumns().get(0).getPortletLayouts().get(1);
    final PortletLayoutElement row31221 = row312.getPortletColumns().get(1).getPortletLayouts().get(0);
    row1.getPortletColumns().remove(row1.getPortletColumns().get(0));
    layoutTpl.getPortletLayouts().remove(row1);
    PortletColumnElement insertedColumn = row311.getPortletColumns().insert();
    insertedColumn.setWeight(3);
    row311.getPortletColumns().get(0).setWeight(9);
    row2.getPortletColumns().remove(row2.getPortletColumns().get(0));
    row2.getPortletColumns().get(0).setWeight(8);
    insertedColumn = row31221.getPortletColumns().insert();
    insertedColumn.setWeight(2);
    row31221.getPortletColumns().get(0).setWeight(10);
    evalModelWithFile(refTplFile, layoutTpl);
}
Also used : IFile(org.eclipse.core.resources.IFile) 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)

Example 22 with PortletColumnElement

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

the class LayoutTplTestsBootstrap method testPortletColumnFullWeightDefaultValueService.

@Test
public void testPortletColumnFullWeightDefaultValueService() throws Exception {
    final LayoutTplElement layoutTpl = LayoutTplElement.TYPE.instantiate();
    layoutTpl.setBootstrapStyle(true);
    final PortletColumnElement column = layoutTpl.getPortletLayouts().insert().getPortletColumns().insert();
    assertEquals(12, column.getFullWeight().content(true).intValue());
}
Also used : PortletColumnElement(com.liferay.ide.layouttpl.core.model.PortletColumnElement) LayoutTplElement(com.liferay.ide.layouttpl.core.model.LayoutTplElement) Test(org.junit.Test)

Example 23 with PortletColumnElement

use of com.liferay.ide.layouttpl.core.model.PortletColumnElement 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

PortletColumnElement (com.liferay.ide.layouttpl.core.model.PortletColumnElement)23 PortletLayoutElement (com.liferay.ide.layouttpl.core.model.PortletLayoutElement)18 LayoutTplElement (com.liferay.ide.layouttpl.core.model.LayoutTplElement)9 Test (org.junit.Test)5 Dimension (org.eclipse.draw2d.geometry.Dimension)2 Status (org.eclipse.sapphire.modeling.Status)2 ValidationService (org.eclipse.sapphire.services.ValidationService)2 ColumnFigure (com.liferay.ide.layouttpl.ui.draw2d.ColumnFigure)1 PortletLayoutPanel (com.liferay.ide.layouttpl.ui.draw2d.PortletLayoutPanel)1 List (java.util.List)1 IFile (org.eclipse.core.resources.IFile)1 GridData (org.eclipse.draw2d.GridData)1 GridLayout (org.eclipse.draw2d.GridLayout)1 IFigure (org.eclipse.draw2d.IFigure)1 RoundedRectangle (org.eclipse.draw2d.RoundedRectangle)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 Element (org.eclipse.sapphire.Element)1 ElementList (org.eclipse.sapphire.ElementList)1 Value (org.eclipse.sapphire.Value)1