Search in sources :

Example 1 with EntityXYLayout

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

the class AbstractConnectedFreeformRootPart method createFigure.

protected IFigure createFigure() {
    // Figure figure = new FreeformLayer();
    IEntityFigure figure = new EntityFigure() {

        {
            setLayoutManager(new EntityXYLayout());
            setOpaque(false);
        }

        // FIXME workaround
        public int getIndent() {
            return getInsets().left;
        }

        public int getAscent() {
            return getPreferredSize().height / 2;
        }

        public static final int MINIMUM_SIZE = 50;

        public Dimension getPreferredSize(int wHint, int hHint) {
            Dimension size = super.getPreferredSize(wHint, hHint);
            size.width = Math.max(size.width, MINIMUM_SIZE);
            size.height = Math.max(size.height, MINIMUM_SIZE);
            return size;
        }
    };
    // figure.setLayoutManager(new EntityXYLayout());
    // figure.setOpaque(false);
    setConnectionRouter(createConnectionRouter(figure));
    return figure;
}
Also used : IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) EntityFigure(org.whole.lang.ui.figures.EntityFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) Dimension(org.eclipse.draw2d.geometry.Dimension) EntityXYLayout(org.whole.lang.ui.layout.EntityXYLayout)

Example 2 with EntityXYLayout

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

the class FreeformRootPart method createFigure.

protected IFigure createFigure() {
    return new EntityFigure() {

        {
            setLayoutManager(new EntityXYLayout());
            setOpaque(false);
        }

        // FIXME workaround
        public int getIndent() {
            return getInsets().left;
        }

        public int getAscent() {
            return getPreferredSize().height / 2;
        }

        public static final int MINIMUM_SIZE = 600;

        public Dimension getPreferredSize(int wHint, int hHint) {
            Dimension size = super.getPreferredSize(wHint, hHint);
            size.width = Math.max(size.width, MINIMUM_SIZE);
            size.height = Math.max(size.height, MINIMUM_SIZE);
            return size;
        }
    };
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) Dimension(org.eclipse.draw2d.geometry.Dimension) EntityXYLayout(org.whole.lang.ui.layout.EntityXYLayout)

Aggregations

Dimension (org.eclipse.draw2d.geometry.Dimension)2 EntityFigure (org.whole.lang.ui.figures.EntityFigure)2 EntityXYLayout (org.whole.lang.ui.layout.EntityXYLayout)2 IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)1