use of org.eclipse.swt.custom.TreeEditor in project yyl_example by Relucent.
the class TableTreeTest method testFreshTableTree.
public void testFreshTableTree() {
for (int i = 0; i < 5; i++) {
TreeItem parent = new TreeItem(tree, SWT.NONE);
parent.setText(0, "类型" + (i + 1));
for (int j = 0; j < 3; j++) {
TreeItem child = new TreeItem(parent, SWT.NONE);
child.setText(0, "");
child.setText(1, "状态1");
child.setText(2, "状态2");
TreeEditor editor = createTreeEditor(tree, SWT.LEFT);
Button button = new Button(tree, SWT.CHECK);
child.setData("EDITOR_3", editor);
editor.setEditor(button, child, 3);
button.setSelection(true);
button.setEnabled(true);
for (int k = 0; k < 3; k++) {
TreeItem grandchild = new TreeItem(child, SWT.NONE);
grandchild.setText(0, "");
grandchild.setText(1, "数据1");
grandchild.setText(2, "数据2");
TreeEditor editor2 = createTreeEditor(tree, SWT.LEFT);
Button button2 = new Button(tree, SWT.CHECK);
grandchild.setData("EDITOR_3", editor2);
editor2.setEditor(button2, grandchild, 3);
button2.setSelection(true);
button2.setEnabled(true);
}
}
parent.setExpanded(false);
}
}
use of org.eclipse.swt.custom.TreeEditor in project yyl_example by Relucent.
the class TableTreeTest method createTreeEditor.
/**
* <p>
* 功能描述:生成一个TreeEditor控件
* </p>
* @param tree TreeEditor控件所属的Tree
* @param horizontalAlignment 水平位置(SWT.CANCEL | SWT.RIGHT | SWT.LEFT)
*/
private TreeEditor createTreeEditor(Tree tree, int horizontalAlignment) {
TreeEditor oTreeEditor = new TreeEditor(tree);
oTreeEditor.horizontalAlignment = horizontalAlignment;
oTreeEditor.grabHorizontal = false;
oTreeEditor.minimumWidth = 12;
oTreeEditor.minimumHeight = 10;
return oTreeEditor;
}
Aggregations