Search in sources :

Example 1 with ColumnFigure

use of com.liferay.ide.layouttpl.ui.draw2d.ColumnFigure in project liferay-ide by liferay.

the class PortletColumnEditPart method refreshVisuals.

protected void refreshVisuals() {
    super.refreshVisuals();
    IFigure parentFigure = ((GraphicalEditPart) getParent()).getFigure();
    LayoutManager layoutManager = parentFigure.getLayoutManager();
    Object constraint = layoutManager.getConstraint(getFigure());
    GridData gd = null;
    if (constraint instanceof GridData) {
        gd = (GridData) constraint;
        if (gd.heightHint == SWT.DEFAULT) {
            gd.heightHint = getCastedParent().getDefaultColumnHeight();
        }
    } else {
        gd = createGridData();
    }
    ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), gd);
    if (getFigure() instanceof ColumnFigure) {
        Value<Integer> weight = getCastedModel().getWeight();
        Integer weightValue = weight.content();
        ((ColumnFigure) getFigure()).setText(weightValue.toString());
    }
}
Also used : LayoutManager(org.eclipse.draw2d.LayoutManager) GridData(org.eclipse.draw2d.GridData) ColumnFigure(com.liferay.ide.layouttpl.ui.draw2d.ColumnFigure) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with ColumnFigure

use of com.liferay.ide.layouttpl.ui.draw2d.ColumnFigure in project liferay-ide by liferay.

the class PortletColumnEditPart method createFigureForModel.

protected Figure createFigureForModel() {
    if (getModel() instanceof PortletColumnElement) {
        RoundedRectangle rect = new ColumnFigure();
        rect.setCornerDimensions(new Dimension(10, 10));
        return rect;
    } else {
        throw new IllegalArgumentException();
    }
}
Also used : PortletColumnElement(com.liferay.ide.layouttpl.core.model.PortletColumnElement) ColumnFigure(com.liferay.ide.layouttpl.ui.draw2d.ColumnFigure) Dimension(org.eclipse.draw2d.geometry.Dimension) RoundedRectangle(org.eclipse.draw2d.RoundedRectangle)

Aggregations

ColumnFigure (com.liferay.ide.layouttpl.ui.draw2d.ColumnFigure)2 PortletColumnElement (com.liferay.ide.layouttpl.core.model.PortletColumnElement)1 GridData (org.eclipse.draw2d.GridData)1 IFigure (org.eclipse.draw2d.IFigure)1 LayoutManager (org.eclipse.draw2d.LayoutManager)1 RoundedRectangle (org.eclipse.draw2d.RoundedRectangle)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1