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);
}
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);
}
}
}
}
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();
}
Aggregations