* A TableTreeEditor is a manager for a Control that appears above a cell in a TableTree and tracks with the moving and resizing of that cell. It can be used to display a text widget above a cell in a TableTree so that the user can edit the contents of that cell. It can also be used to display a button that can launch a dialog for modifying the contents of the associated cell. * <p> Here is an example of using a TableTreeEditor: <code><pre> final TableTree tableTree = new TableTree(shell, SWT.FULL_SELECTION | SWT.HIDE_SELECTION); final Table table = tableTree.getTable(); TableColumn column1 = new TableColumn(table, SWT.NONE); TableColumn column2 = new TableColumn(table, SWT.NONE); for (int i = 0; i < 10; i++) { TableTreeItem item = new TableTreeItem(tableTree, SWT.NONE); item.setText(0, "item " + i); item.setText(1, "edit this value"); for (int j = 0; j < 3; j++) { TableTreeItem subitem = new TableTreeItem(item, SWT.NONE); subitem.setText(0, "subitem " + i + " " + j); subitem.setText(1, "edit this value"); } } column1.setWidth(100); column2.pack(); * final TableTreeEditor editor = new TableTreeEditor(tableTree); //The editor must have the same size as the cell and must //not be any smaller than 50 pixels. editor.horizontalAlignment = SWT.LEFT; editor.grabHorizontal = true; editor.minimumWidth = 50; // editing the second column final int EDITABLECOLUMN = 1; * tableTree.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // Clean up any previous editor control Control oldEditor = editor.getEditor(); if (oldEditor !is null) oldEditor.dispose(); * // Identify the selected row TableTreeItem item = (TableTreeItem)e.item; if (item is null) return; * // The control that will be the editor must be a child of the Table Text newEditor = new Text(table, SWT.NONE); newEditor.setText(item.getText(EDITABLECOLUMN)); newEditor.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { Text text = (Text)editor.getEditor(); editor.getItem().setText(EDITABLECOLUMN, text.getText()); } }); newEditor.selectAll(); newEditor.setFocus(); editor.setEditor(newEditor, item, EDITABLECOLUMN); } }); </pre></code> * @deprecated As of 3.1 use TreeEditor with Tree, TreeItem and TreeColumn
Copyright (c) 2000, 2007 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 Port to the D programming language: Frank Benoit <benoit@tionex.de>