Search in sources :

Example 36 with TreeEditor

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);
    }
}
Also used : TreeEditor(org.eclipse.swt.custom.TreeEditor) TreeItem(org.eclipse.swt.widgets.TreeItem) Button(org.eclipse.swt.widgets.Button)

Example 37 with TreeEditor

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;
}
Also used : TreeEditor(org.eclipse.swt.custom.TreeEditor)

Aggregations

TreeEditor (org.eclipse.swt.custom.TreeEditor)37 TreeItem (org.eclipse.swt.widgets.TreeItem)24 MouseEvent (org.eclipse.swt.events.MouseEvent)16 SelectionEvent (org.eclipse.swt.events.SelectionEvent)13 MouseAdapter (org.eclipse.swt.events.MouseAdapter)10 FocusEvent (org.eclipse.swt.events.FocusEvent)8 KeyEvent (org.eclipse.swt.events.KeyEvent)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 Point (org.eclipse.swt.graphics.Point)8 Label (org.eclipse.swt.widgets.Label)8 CCombo (org.eclipse.swt.custom.CCombo)5 Control (org.eclipse.swt.widgets.Control)5 FocusAdapter (org.eclipse.swt.events.FocusAdapter)4 KeyAdapter (org.eclipse.swt.events.KeyAdapter)4 Text (org.eclipse.swt.widgets.Text)4 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 CTabFolderEvent (org.eclipse.swt.custom.CTabFolderEvent)3 DragSourceEvent (org.eclipse.swt.dnd.DragSourceEvent)3