Search in sources :

Example 1 with ExpandCollapseFigure

use of org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure in project tdi-studio-se by Talend.

the class TreeBranchLayout method layout.

@Override
public void layout(IFigure container) {
    TreeAnimation.recordInitialState(container);
    if (TreeAnimation.playbackState(container)) {
        return;
    }
    Rectangle clientArea = container.getClientArea();
    int X = clientArea.x + 15;
    int Y = clientArea.y + clientArea.height;
    xOffset = 15;
    Dimension titleSize = treeBranch.getTitle().getPreferredSize();
    Rectangle titleBounds = new Rectangle();
    titleBounds.setSize(titleSize);
    if (treeBranch.isEnableExpand()) {
        final int tDeeps = treeBranch.getDepth();
        int titleOffset = (tDeeps - 1) * 2 * treeBranch.getGaps();
        X = X + titleOffset;
        xOffset = xOffset + titleOffset;
        ExpandCollapseFigure expandCollapseFigure = treeBranch.getExpandCollapseFigure();
        final Dimension ecSize = expandCollapseFigure.getPreferredSize();
        Rectangle ecBounds = new Rectangle();
        ecBounds.setSize(ecSize);
        int maxHeight = Math.max(titleSize.height, ecSize.height);
        Y = Y - maxHeight;
        int ecX = X - 15 + 1;
        ecBounds.setLocation(ecX, Y);
        expandCollapseFigure.setBounds(ecBounds);
    } else {
        Y = Y - titleSize.height;
    }
    titleBounds.setLocation(X, Y);
    // if (clientArea.getRight().x > titleBounds.getRight().x) {
    // int newWidth = clientArea.getRight().x - titleBounds.x;
    // titleBounds.width = newWidth;
    // }
    treeBranch.getTitle().setBounds(titleBounds);
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) Dimension(org.eclipse.draw2d.geometry.Dimension) Point(org.eclipse.draw2d.geometry.Point) ExpandCollapseFigure(org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)

Example 2 with ExpandCollapseFigure

use of org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure in project tdi-studio-se by Talend.

the class TreeExpandSupportEditPolicy method activate.

@Override
public void activate() {
    super.activate();
    TableEntityPart host = (TableEntityPart) getHost();
    if (host.getFigure() instanceof TableEntityFigure) {
        TableTreeEntityFigure treeNodeFigure = (TableTreeEntityFigure) host.getFigure();
        if (treeNodeFigure.getTreeBranch() != null) {
            ExpandCollapseFigure ecFigure = treeNodeFigure.getTreeBranch().getExpandCollapseFigure();
            if (ecFigure != null) {
                ecFigure.addMouseListener(l);
            }
        }
    }
}
Also used : TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) TableEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure) ExpandCollapseFigure(org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)

Example 3 with ExpandCollapseFigure

use of org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure in project tdi-studio-se by Talend.

the class TreeExpandSupportEditPolicy method deactivate.

@Override
public void deactivate() {
    TableEntityPart host = (TableEntityPart) getHost();
    if (host.getFigure() instanceof TableTreeEntityFigure) {
        TableTreeEntityFigure treeNodeFigure = (TableTreeEntityFigure) host.getFigure();
        if (treeNodeFigure.getTreeBranch() != null) {
            ExpandCollapseFigure ecFigure = treeNodeFigure.getTreeBranch().getExpandCollapseFigure();
            if (ecFigure != null) {
                ecFigure.removeMouseListener(l);
            }
        }
    }
    super.deactivate();
}
Also used : TableEntityPart(org.talend.designer.gefabstractmap.part.TableEntityPart) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) ExpandCollapseFigure(org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)

Aggregations

ExpandCollapseFigure (org.talend.designer.gefabstractmap.figures.table.entity.ExpandCollapseFigure)3 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)2 TableEntityPart (org.talend.designer.gefabstractmap.part.TableEntityPart)2 Dimension (org.eclipse.draw2d.geometry.Dimension)1 Point (org.eclipse.draw2d.geometry.Point)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 TableEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableEntityFigure)1