📄 starlayout.java
字号:
package net.sf.freenote.mindmap.figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
/**
* mm图的星形布局
* @author levin
* @since 2008-2-14 下午08:48:39
*/
class StarLayout extends NormalLayout {
StarLayout(TreeBranchFigure branch) {
super(branch);
}
@Override
void paintLines(Graphics g) {
//用connection代替连线,见BranchShape.addChild()
}
@Override
public void layout(IFigure f) {
Animation.recordInitialState(f);
if (Animation.playbackState(f))
return;
branch.getContentsPane().validate();
Rectangle clientArea = new Rectangle();
branch.getClientArea(clientArea);
Rectangle nodeBounds = new Rectangle();
nodeBounds.setSize(branch.getNode().getPreferredSize());
nodeBounds.setLocation(clientArea.x+clientArea.width/2-nodeBounds.width/2, clientArea.y+clientArea.height/2-nodeBounds.height/2);
branch.getNode().setBounds(nodeBounds);
IFigure contents = branch.getContentsPane();
Rectangle contentsBounds = new Rectangle(
clientArea.getLocation(),
contents.getPreferredSize()
);
contents.setBounds(contentsBounds);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -