Search in sources :

Example 6 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project cogtool by cogtool.

the class ProjectUIModel method recoverTreeItem.

protected void recoverTreeItem(TreeItem rowToDelete) {
    if (rowHook != null) {
        rowHook.onRowDeletion(rowToDelete);
    }
    // Need to call getData BEFORE calling dispose, otherwise a
    // widgetIsDisposed error is created.
    taskTreeItems.remove(rowToDelete.getData());
    TreeItem deletedRowParent = rowToDelete.getParentItem();
    rowToDelete.dispose();
    if (deletedRowParent != null) {
        redisplayResults(deletedRowParent);
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem)

Example 7 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project cogtool by cogtool.

the class ProjectUIModel method installUndertakings.

// setGroupAlertHandlers
protected void installUndertakings() {
    Iterator<AUndertaking> undertakings = project.getUndertakings().iterator();
    while (undertakings.hasNext()) {
        AUndertaking undertaking = undertakings.next();
        TreeItem row = new TreeItem(tree, SWT.NONE);
        populateRow(undertaking, row);
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) AUndertaking(edu.cmu.cs.hcii.cogtool.model.AUndertaking)

Example 8 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project cogtool by cogtool.

the class TreeItemUpdater method updateTreeItems.

protected void updateTreeItems(TreeItem[] items, Iterator<? extends T> objects) {
    for (int i = 0; i < items.length; i++) {
        if (objects.hasNext()) {
            T o = objects.next();
            String text = getObjectText(o);
            if (!(text.equals(items[i].getText()))) {
                items[i].setText(text);
                items[i].setData(o);
            }
            TreeItem[] subrows = items[i].getItems();
            Iterator<C> childObjects = getObjectChildren(o);
            TreeItemUpdater<C, ?> updater = getChildUpdater(items[i]);
            if (updater != null) {
                updater.updateTreeItems(subrows, childObjects);
            }
        } else {
            items[i].dispose();
        }
    }
    populateExtraItems(objects);
}
Also used : SWT(org.eclipse.swt.SWT) TreeItem(org.eclipse.swt.widgets.TreeItem)

Example 9 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project GT by Tencent.

the class CopyAllFromTreeViewAction method getContents.

/**
	 * 获取treeview控件的所有数据
	 * @return
	 */
private StringBuffer getContents() {
    StringBuffer sb = new StringBuffer();
    int columnCount = viewer.getTree().getColumnCount();
    // 表头
    for (TreeColumn column : viewer.getTree().getColumns()) {
        sb.append(column.getText());
        sb.append(SourceDataItem.SPLIT);
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\r\n");
    for (TreeItem tableItem : viewer.getTree().getItems()) {
        parseTree(tableItem, columnCount, sb);
    }
    return sb;
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) TreeColumn(org.eclipse.swt.widgets.TreeColumn)

Example 10 with TreeItem

use of org.eclipse.swt.widgets.TreeItem in project GT by Tencent.

the class CopyAllFromTreeViewAction method parseTree.

/*
	 * 递归解析树
	 * @param parent
	 * @param sb
	 */
private void parseTree(TreeItem curItem, int columnCount, StringBuffer sb) {
    if (null == curItem.getData()) {
        return;
    }
    // 打层次点"."
    int deep = calcDeep(curItem);
    for (int i = 0; i < deep; i++) {
        sb.append('.');
    }
    // 内容
    for (int i = 0; i < columnCount; i++) {
        sb.append(curItem.getText(i));
        sb.append(SourceDataItem.SPLIT);
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\r\n");
    for (TreeItem item : curItem.getItems()) {
        parseTree(item, columnCount, sb);
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem)

Aggregations

TreeItem (org.eclipse.swt.widgets.TreeItem)150 Tree (org.eclipse.swt.widgets.Tree)36 SelectionEvent (org.eclipse.swt.events.SelectionEvent)23 GridData (org.eclipse.swt.layout.GridData)23 Point (org.eclipse.swt.graphics.Point)21 ArrayList (java.util.ArrayList)20 TreeColumn (org.eclipse.swt.widgets.TreeColumn)18 GridLayout (org.eclipse.swt.layout.GridLayout)17 TreeViewer (org.eclipse.jface.viewers.TreeViewer)16 Composite (org.eclipse.swt.widgets.Composite)14 TableItem (org.eclipse.swt.widgets.TableItem)14 SelectionListener (org.eclipse.swt.events.SelectionListener)13 Group (org.eclipse.swt.widgets.Group)13 Button (org.eclipse.swt.widgets.Button)12 Table (org.eclipse.swt.widgets.Table)12 Event (org.eclipse.swt.widgets.Event)11 List (java.util.List)10 Label (org.eclipse.swt.widgets.Label)10 CubridGroupNode (com.cubrid.common.ui.spi.model.CubridGroupNode)9 AUndertaking (edu.cmu.cs.hcii.cogtool.model.AUndertaking)9