treerootfigure.java

来自「mywork是rcp开发的很好的例子」· Java 代码 · 共 113 行

JAVA
113
字号
/*******************************************************************************
 * Copyright (c) 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package net.sf.freenote.mindmap.figure;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Transposer;

/**
 * 
 * @author hudsonr
 * Created on Apr 23, 2003
 */
public class TreeRootFigure extends TreeBranchFigure {

private int major = 10;
private int minor = 10;
private Transposer transposer = new Transposer();
private boolean compression;
/**
 * @param title
 */
public TreeRootFigure(IFigure title) {
	super(title);
}

/**
 * @param title
 * @param style
 */
public TreeRootFigure(IFigure title, int style) {
	super(title, style);
}

public int getMajorSpacing() {
	return major;
}

/**
 * @return
 */
public int getMinorSpacing() {
	return minor;
}

public TreeRootFigure getRoot() {
	return this;
}

public Transposer getTransposer() {
	return transposer;
}

public boolean isHorizontal() {
	return !transposer.isEnabled();
}

/**
 * sets the space (in pixels) between this branch's node and its subtrees.
 */
public void setMajorSpacing(int value) {
	this.major = value;
	invalidateTree();
	revalidate();
}

public void setHorizontal(boolean value) {
	transposer.setEnabled(!value);
	invalidateTree();
	revalidate();
}

/**
 * @param i
 */
public void setMinorSpacing(int i) {
	minor = i;
	invalidateTree();
	revalidate();
}

/**
 * @see org.eclipse.draw2d.Figure#validate()
 */
public void validate() {
	if (isValid())
		return;
	setRowHeights(getPreferredRowHeights(), 0);
	super.validate();
}

/**
 * @return
 */
public boolean isCompressed() {
	return compression;
}

/**
 * @param b
 */
public void setCompression(boolean b) {
	compression = b;
}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?