Search in sources :

Example 1 with TableRowLayout

use of org.whole.lang.ui.layout.TableRowLayout in project whole by wholeplatform.

the class CompositeEntityReferenceTextFigure method setAdjacentSize.

public void setAdjacentSize(int size) {
    for (int i = compositeFigure.getChildren().size(); i < size; i++) {
        EntityFigure featureRow = new EntityFigure(new TableRowLayout().withMinorAlignment(Alignment.LEADING));
        featureRow.add(new EntityButton(linkListener, i));
        compositeFigure.add(featureRow);
    }
    while (compositeFigure.getChildren().size() > size) compositeFigure.remove((IFigure) compositeFigure.getChildren().get(size));
    revalidate();
    repaint();
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) TableRowLayout(org.whole.lang.ui.layout.TableRowLayout) EntityButton(org.whole.lang.ui.figures.EntityButton) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with TableRowLayout

use of org.whole.lang.ui.layout.TableRowLayout in project whole by wholeplatform.

the class CompositeEntityReferenceColumnFigure method setAdjacentSize.

public void setAdjacentSize(int size) {
    for (int i = tableFigure.getChildren().size(); i < size; i++) {
        EntityFigure featureRow = new EntityFigure(new TableRowLayout().withMinorAlignment(Alignment.LEADING));
        featureRow.add(new EntityButton(linkListener, i));
        tableFigure.add(featureRow);
    }
    while (tableFigure.getChildren().size() > size) tableFigure.remove((IFigure) tableFigure.getChildren().get(size));
    revalidate();
    repaint();
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) TableRowLayout(org.whole.lang.ui.layout.TableRowLayout) EntityButton(org.whole.lang.ui.figures.EntityButton) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with TableRowLayout

use of org.whole.lang.ui.layout.TableRowLayout in project whole by wholeplatform.

the class EntityOutlineLeftFigure method paintConnections.

@SuppressWarnings("unchecked")
protected void paintConnections(Graphics graphics) {
    graphics.setForegroundColor(FigureConstants.contentLighterColor);
    Point rootPoint = getFoldingToggle(0).getBounds().getBottom();
    Object childrenFigure = getContentPane(1).getChildren().get(0);
    Point[] childrenPoints = null;
    if (childrenFigure instanceof TableFigure) {
        TableFigure tableFigure = (TableFigure) childrenFigure;
        TableLayout layoutManager = tableFigure.getLayoutManager();
        int childrenSize = layoutManager.rows();
        childrenPoints = new Point[childrenSize];
        if (childrenSize == 0)
            return;
        for (int i = 0; i < childrenSize; i++) {
            IFigure row = layoutManager.getRow(i);
            List<IFigure> rowChildren = row.getChildren();
            childrenPoints[i] = row.getBounds().getRight().translate(+8, 0);
            if (row instanceof TableRowFigure && !rowChildren.isEmpty())
                childrenPoints[i].y = ((TableRowLayout) row.getLayoutManager()).getBaseline(1);
        }
    } else {
        List<IFigure> children = ((IFigure) childrenFigure).getChildren();
        int childrenSize = children.size();
        if (childrenSize == 0)
            return;
        childrenPoints = new Point[childrenSize];
        for (int i = 0; i < childrenSize; i++) {
            IFigure childFigure = children.get(i);
            if (childFigure instanceof IEntityFigure)
                childrenPoints[i] = childFigure.getBounds().getTopRight().translate(+6, ((IEntityFigure) childFigure).getAscent());
            else
                childrenPoints[i] = childFigure.getBounds().getRight().translate(+6, 0);
        }
    }
    graphics.setForegroundColor(ColorConstants.lightGray);
    graphics.setLineStyle(SWT.LINE_CUSTOM);
    graphics.setLineDash(new int[] { 1, 1 });
    DrawUtils.drawOutline(graphics, rootPoint, childrenPoints);
    graphics.setLineStyle(SWT.LINE_SOLID);
    graphics.setLineDash((int[]) null);
}
Also used : TableRowFigure(org.whole.lang.ui.figures.TableRowFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) TableFigure(org.whole.lang.ui.figures.TableFigure) TableRowLayout(org.whole.lang.ui.layout.TableRowLayout) Point(org.eclipse.draw2d.geometry.Point) TableLayout(org.whole.lang.ui.layout.TableLayout) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IFigure (org.eclipse.draw2d.IFigure)3 TableRowLayout (org.whole.lang.ui.layout.TableRowLayout)3 EntityButton (org.whole.lang.ui.figures.EntityButton)2 EntityFigure (org.whole.lang.ui.figures.EntityFigure)2 Point (org.eclipse.draw2d.geometry.Point)1 IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)1 TableFigure (org.whole.lang.ui.figures.TableFigure)1 TableRowFigure (org.whole.lang.ui.figures.TableRowFigure)1 TableLayout (org.whole.lang.ui.layout.TableLayout)1