KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > TableTreeViewer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  * Tom Schindl <tom.schindl@bestsolution.at> - bug 153993
11  *******************************************************************************/

12
13 package org.eclipse.jface.viewers;
14
15 import java.util.List JavaDoc;
16
17 import org.eclipse.swt.SWT;
18 import org.eclipse.swt.custom.TableTree;
19 import org.eclipse.swt.custom.TableTreeEditor;
20 import org.eclipse.swt.custom.TableTreeItem;
21 import org.eclipse.swt.events.FocusAdapter;
22 import org.eclipse.swt.events.FocusEvent;
23 import org.eclipse.swt.events.FocusListener;
24 import org.eclipse.swt.events.MouseAdapter;
25 import org.eclipse.swt.events.MouseEvent;
26 import org.eclipse.swt.events.MouseListener;
27 import org.eclipse.swt.events.TreeListener;
28 import org.eclipse.swt.graphics.Image;
29 import org.eclipse.swt.graphics.Point;
30 import org.eclipse.swt.graphics.Rectangle;
31 import org.eclipse.swt.widgets.Composite;
32 import org.eclipse.swt.widgets.Control;
33 import org.eclipse.swt.widgets.Display;
34 import org.eclipse.swt.widgets.Item;
35 import org.eclipse.swt.widgets.Widget;
36
37 /**
38  * A concrete viewer based on a SWT <code>TableTree</code> control.
39  * <p>
40  * This class is not intended to be subclassed outside the viewer framework. It
41  * is designed to be instantiated with a pre-existing SWT table tree control and
42  * configured with a domain-specific content provider, label provider, element
43  * filter (optional), and element sorter (optional).
44  * </p>
45  * <p>
46  * Content providers for table tree viewers must implement the
47  * <code>ITreeContentProvider</code> interface.
48  * </p>
49  * <p>
50  * Label providers for table tree viewers must implement either the
51  * <code>ITableLabelProvider</code> or the <code>ILabelProvider</code>
52  * interface (see <code>TableTreeViewer.setLabelProvider</code> for more
53  * details).
54  * </p>
55  *
56  * @deprecated As of 3.1 use {@link TreeViewer} instead
57  */

58 public class TableTreeViewer extends AbstractTreeViewer {
59     /**
60      * Internal table viewer implementation.
61      */

62     private TableTreeEditorImpl tableEditorImpl;
63
64     /**
65      * This viewer's table tree control.
66      */

67     private TableTree tableTree;
68
69     /**
70      * This viewer's table tree editor.
71      */

72     private TableTreeEditor tableTreeEditor;
73
74     /**
75      * Copied from original TableEditorImpl and moved here since refactoring
76      * completely wiped out the original implementation in 3.3
77      *
78      * @since 3.1
79      */

80     class TableTreeEditorImpl {
81
82         private CellEditor cellEditor;
83
84         private CellEditor[] cellEditors;
85
86         private ICellModifier cellModifier;
87
88         private String JavaDoc[] columnProperties;
89
90         private Item tableItem;
91
92         private int columnNumber;
93
94         private ICellEditorListener cellEditorListener;
95
96         private FocusListener focusListener;
97
98         private MouseListener mouseListener;
99
100         private int doubleClickExpirationTime;
101
102         private ColumnViewer viewer;
103
104         private TableTreeEditorImpl(ColumnViewer viewer) {
105             this.viewer = viewer;
106             initCellEditorListener();
107         }
108
109         /**
110          * Returns this <code>TableViewerImpl</code> viewer
111          *
112          * @return the viewer
113          */

114         public ColumnViewer getViewer() {
115             return viewer;
116         }
117
118         private void activateCellEditor() {
119             if( cellEditors != null ) {
120                 if( cellEditors[columnNumber] != null && cellModifier != null ) {
121                     Object JavaDoc element = tableItem.getData();
122                     String JavaDoc property = columnProperties[columnNumber];
123                     
124                     if( cellModifier.canModify(element, property) ) {
125                         cellEditor = cellEditors[columnNumber];
126                         
127                         cellEditor.addListener(cellEditorListener);
128                         
129                         Object JavaDoc value = cellModifier.getValue(element, property);
130                         cellEditor.setValue(value);
131                         // Tricky flow of control here:
132
// activate() can trigger callback to cellEditorListener
133
// which will clear cellEditor
134
// so must get control first, but must still call activate()
135
// even if there is no control.
136
final Control control = cellEditor.getControl();
137                         cellEditor.activate();
138                         if (control == null) {
139                             return;
140                         }
141                         setLayoutData(cellEditor.getLayoutData());
142                         setEditor(control, tableItem, columnNumber);
143                         cellEditor.setFocus();
144                         if (focusListener == null) {
145                             focusListener = new FocusAdapter() {
146                                 public void focusLost(FocusEvent e) {
147                                     applyEditorValue();
148                                 }
149                             };
150                         }
151                         control.addFocusListener(focusListener);
152                         mouseListener = new MouseAdapter() {
153                             public void mouseDown(MouseEvent e) {
154                                 // time wrap?
155
// check for expiration of doubleClickTime
156
if (e.time <= doubleClickExpirationTime) {
157                                     control.removeMouseListener(mouseListener);
158                                     cancelEditing();
159                                     handleDoubleClickEvent();
160                                 } else if (mouseListener != null) {
161                                     control.removeMouseListener(mouseListener);
162                                 }
163                             }
164                         };
165                         control.addMouseListener(mouseListener);
166                     }
167                 }
168             }
169         }
170
171         /**
172          * Activate a cell editor for the given mouse position.
173          */

174         private void activateCellEditor(MouseEvent event) {
175             if (tableItem == null || tableItem.isDisposed()) {
176                 // item no longer exists
177
return;
178             }
179             int columnToEdit;
180             int columns = getColumnCount();
181             if (columns == 0) {
182                 // If no TableColumn, Table acts as if it has a single column
183
// which takes the whole width.
184
columnToEdit = 0;
185             } else {
186                 columnToEdit = -1;
187                 for (int i = 0; i < columns; i++) {
188                     Rectangle bounds = getBounds(tableItem, i);
189                     if (bounds.contains(event.x, event.y)) {
190                         columnToEdit = i;
191                         break;
192                     }
193                 }
194                 if (columnToEdit == -1) {
195                     return;
196                 }
197             }
198
199             columnNumber = columnToEdit;
200             activateCellEditor();
201         }
202
203         /**
204          * Deactivates the currently active cell editor.
205          */

206         public void applyEditorValue() {
207             CellEditor c = this.cellEditor;
208             if (c != null) {
209                 // null out cell editor before calling save
210
// in case save results in applyEditorValue being re-entered
211
// see 1GAHI8Z: ITPUI:ALL - How to code event notification when
212
// using cell editor ?
213
this.cellEditor = null;
214                 Item t = this.tableItem;
215                 // don't null out table item -- same item is still selected
216
if (t != null && !t.isDisposed()) {
217                     saveEditorValue(c, t);
218                 }
219                 setEditor(null, null, 0);
220                 c.removeListener(cellEditorListener);
221                 Control control = c.getControl();
222                 if (control != null) {
223                     if (mouseListener != null) {
224                         control.removeMouseListener(mouseListener);
225                     }
226                     if (focusListener != null) {
227                         control.removeFocusListener(focusListener);
228                     }
229                 }
230                 c.deactivate();
231             }
232         }
233
234         /**
235          * Cancels the active cell editor, without saving the value back to the
236          * domain model.
237          */

238         public void cancelEditing() {
239             if (cellEditor != null) {
240                 setEditor(null, null, 0);
241                 cellEditor.removeListener(cellEditorListener);
242                 CellEditor oldEditor = cellEditor;
243                 cellEditor = null;
244                 oldEditor.deactivate();
245             }
246         }
247
248         /**
249          * Start editing the given element.
250          *
251          * @param element
252          * @param column
253          */

254         public void editElement(Object JavaDoc element, int column) {
255             if (cellEditor != null) {
256                 applyEditorValue();
257             }
258
259             setSelection(new StructuredSelection(element), true);
260             Item[] selection = getSelection();
261             if (selection.length != 1) {
262                 return;
263             }
264
265             tableItem = selection[0];
266
267             // Make sure selection is visible
268
showSelection();
269             columnNumber = column;
270             activateCellEditor();
271
272         }
273
274         /**
275          * Return the array of CellEditors used in the viewer
276          *
277          * @return the cell editors
278          */

279         public CellEditor[] getCellEditors() {
280             return cellEditors;
281         }
282
283         /**
284          * Get the cell modifier
285          *
286          * @return the cell modifier
287          */

288         public ICellModifier getCellModifier() {
289             return cellModifier;
290         }
291
292         /**
293          * Return the properties for the column
294          *
295          * @return the array of column properties
296          */

297         public Object JavaDoc[] getColumnProperties() {
298             return columnProperties;
299         }
300
301         /**
302          * Handles the mouse down event; activates the cell editor.
303          *
304          * @param event
305          * the mouse event that should be handled
306          */

307         public void handleMouseDown(MouseEvent event) {
308             if (event.button != 1) {
309                 return;
310             }
311
312             if (cellEditor != null) {
313                 applyEditorValue();
314             }
315
316             // activate the cell editor immediately. If a second mouseDown
317
// is received prior to the expiration of the doubleClick time then
318
// the cell editor will be deactivated and a doubleClick event will
319
// be processed.
320
//
321
doubleClickExpirationTime = event.time
322                     + Display.getCurrent().getDoubleClickTime();
323
324             Item[] items = getSelection();
325             // Do not edit if more than one row is selected.
326
if (items.length != 1) {
327                 tableItem = null;
328                 return;
329             }
330             tableItem = items[0];
331             
332             activateCellEditor(event);
333         }
334
335         private void initCellEditorListener() {
336             cellEditorListener = new ICellEditorListener() {
337                 public void editorValueChanged(boolean oldValidState,
338                         boolean newValidState) {
339                     // Ignore.
340
}
341
342                 public void cancelEditor() {
343                     TableTreeEditorImpl.this.cancelEditing();
344                 }
345
346                 public void applyEditorValue() {
347                     TableTreeEditorImpl.this.applyEditorValue();
348                 }
349             };
350         }
351
352         /**
353          * Return whether there is an active cell editor.
354          *
355          * @return <code>true</code> if there is an active cell editor;
356          * otherwise <code>false</code> is returned.
357          */

358         public boolean isCellEditorActive() {
359             return cellEditor != null;
360         }
361
362         /**
363          * Saves the value of the currently active cell editor, by delegating to
364          * the cell modifier.
365          */

366         private void saveEditorValue(CellEditor cellEditor, Item tableItem) {
367             if( cellModifier != null ) {
368                 if( ! cellEditor.isValueValid() ) {
369                     // Do what????
370
}
371             }
372             String JavaDoc property = null;
373             
374             if( columnProperties != null && columnNumber < columnProperties.length ) {
375                 property = columnProperties[columnNumber];
376             }
377             cellModifier.modify(tableItem, property, cellEditor.getValue());
378         }
379
380         /**
381          * Set the cell editors
382          *
383          * @param editors
384          */

385         public void setCellEditors(CellEditor[] editors) {
386             this.cellEditors = editors;
387         }
388
389         /**
390          * Set the cell modifier
391          *
392          * @param modifier
393          */

394         public void setCellModifier(ICellModifier modifier) {
395             this.cellModifier = modifier;
396         }
397
398         /**
399          * Set the column properties
400          *
401          * @param columnProperties
402          */

403         public void setColumnProperties(String JavaDoc[] columnProperties) {
404             this.columnProperties = columnProperties;
405         }
406
407         Rectangle getBounds(Item item, int columnNumber) {
408             return ((TableTreeItem) item).getBounds(columnNumber);
409         }
410
411         int getColumnCount() {
412             // getColumnCount() should be a API in TableTree.
413
return getTableTree().getTable().getColumnCount();
414         }
415
416         Item[] getSelection() {
417             return getTableTree().getSelection();
418         }
419
420         void setEditor(Control w, Item item, int columnNumber) {
421             tableTreeEditor.setEditor(w, (TableTreeItem) item, columnNumber);
422         }
423
424         void setSelection(StructuredSelection selection, boolean b) {
425             TableTreeViewer.this.setSelection(selection, b);
426         }
427
428         void showSelection() {
429             getTableTree().showSelection();
430         }
431
432         void setLayoutData(CellEditor.LayoutData layoutData) {
433             tableTreeEditor.horizontalAlignment = layoutData.horizontalAlignment;
434             tableTreeEditor.grabHorizontal = layoutData.grabHorizontal;
435             tableTreeEditor.minimumWidth = layoutData.minimumWidth;
436         }
437
438         void handleDoubleClickEvent() {
439             Viewer viewer = getViewer();
440             fireDoubleClick(new DoubleClickEvent(viewer, viewer.getSelection()));
441             fireOpen(new OpenEvent(viewer, viewer.getSelection()));
442         }
443     }
444
445     /**
446      * Creates a table tree viewer on the given table tree control. The viewer
447      * has no input, no content provider, a default label provider, no sorter,
448      * and no filters.
449      *
450      * @param tree
451      * the table tree control
452      */

453     public TableTreeViewer(TableTree tree) {
454         super();
455         tableTree = tree;
456         hookControl(tree);
457         tableTreeEditor = new TableTreeEditor(tableTree);
458         tableEditorImpl = new TableTreeEditorImpl(this);
459     }
460
461     /**
462      * Creates a table tree viewer on a newly-created table tree control under
463      * the given parent. The table tree control is created using the SWT style
464      * bits <code>MULTI, H_SCROLL, V_SCROLL, and BORDER</code>. The viewer
465      * has no input, no content provider, a default label provider, no sorter,
466      * and no filters.
467      *
468      * @param parent
469      * the parent control
470      */

471     public TableTreeViewer(Composite parent) {
472         this(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
473     }
474
475     /**
476      * Creates a table tree viewer on a newly-created table tree control under
477      * the given parent. The table tree control is created using the given SWT
478      * style bits. The viewer has no input, no content provider, a default label
479      * provider, no sorter, and no filters.
480      *
481      * @param parent
482      * the parent control
483      * @param style
484      * the SWT style bits
485      */

486     public TableTreeViewer(Composite parent, int style) {
487         this(new TableTree(parent, style));
488     }
489
490     /*
491      * (non-Javadoc) Method declared on AbstractTreeViewer.
492      */

493     protected void addTreeListener(Control c, TreeListener listener) {
494         ((TableTree) c).addTreeListener(listener);
495     }
496
497     /**
498      * Cancels a currently active cell editor. All changes already done in the
499      * cell editor are lost.
500      */

501     public void cancelEditing() {
502         tableEditorImpl.cancelEditing();
503     }
504
505     /*
506      * (non-Javadoc) Method declared on AbstractTreeViewer.
507      */

508     protected void doUpdateItem(Item item, Object JavaDoc element) {
509         // update icon and label
510
// Similar code in TableTreeViewer.doUpdateItem()
511
IBaseLabelProvider prov = getLabelProvider();
512         ITableLabelProvider tprov = null;
513
514         if (prov instanceof ITableLabelProvider) {
515             tprov = (ITableLabelProvider) prov;
516         }
517
518         int columnCount = tableTree.getTable().getColumnCount();
519         TableTreeItem ti = (TableTreeItem) item;
520         // Also enter loop if no columns added. See 1G9WWGZ: JFUIF:WINNT -
521
// TableViewer with 0 columns does not work
522
for (int column = 0; column < columnCount || column == 0; column++) {
523             String JavaDoc text = "";//$NON-NLS-1$
524
Image image = null;
525             if (tprov != null) {
526                 text = tprov.getColumnText(element, column);
527                 image = tprov.getColumnImage(element, column);
528             } else {
529                 if (column == 0) {
530                     ViewerLabel updateLabel = new ViewerLabel(item.getText(),
531                             item.getImage());
532                     buildLabel(updateLabel, element);
533
534                     // As it is possible for user code to run the event
535
// loop check here.
536
if (item.isDisposed()) {
537                         unmapElement(element, item);
538                         return;
539                     }
540
541                     text = updateLabel.getText();
542                     image = updateLabel.getImage();
543                 }
544             }
545
546             // Avoid setting text to null
547
if (text == null) {
548                 text = ""; //$NON-NLS-1$
549
}
550
551             ti.setText(column, text);
552             // Apparently a problem to setImage to null if already null
553
if (ti.getImage(column) != image) {
554                 ti.setImage(column, image);
555             }
556
557             getColorAndFontCollector().setFontsAndColors(element);
558             getColorAndFontCollector().applyFontsAndColors(ti);
559         }
560
561     }
562
563     /**
564      * Starts editing the given element.
565      *
566      * @param element
567      * the element
568      * @param column
569      * the column number
570      */

571     public void editElement(Object JavaDoc element, int column) {
572         tableEditorImpl.editElement(element, column);
573     }
574
575     /**
576      * Returns the cell editors of this viewer.
577      *
578      * @return the list of cell editors
579      */

580     public CellEditor[] getCellEditors() {
581         return tableEditorImpl.getCellEditors();
582     }
583
584     /**
585      * Returns the cell modifier of this viewer.
586      *
587      * @return the cell modifier
588      */

589     public ICellModifier getCellModifier() {
590         return tableEditorImpl.getCellModifier();
591     }
592
593     /*
594      * (non-Javadoc) Method declared on AbstractTreeViewer.
595      */

596     protected Item[] getChildren(Widget o) {
597         if (o instanceof TableTreeItem) {
598             return ((TableTreeItem) o).getItems();
599         }
600         if (o instanceof TableTree) {
601             return ((TableTree) o).getItems();
602         }
603         return null;
604     }
605
606     /*
607      * (non-Javadoc)
608      *
609      * @see org.eclipse.jface.viewers.AbstractTreeViewer#getChild(org.eclipse.swt.widgets.Widget,
610      * int)
611      */

612     protected Item getChild(Widget widget, int index) {
613         if (widget instanceof TableTreeItem) {
614             return ((TableTreeItem) widget).getItem(index);
615         }
616         if (widget instanceof TableTree) {
617             return ((TableTree) widget).getItem(index);
618         }
619         return null;
620     }
621
622     /**
623      * Returns the column properties of this viewer. The properties must
624      * correspond with the columns of the table control. They are used to
625      * identify the column in a cell modifier.
626      *
627      * @return the list of column properties
628      */

629     public Object JavaDoc[] getColumnProperties() {
630         return tableEditorImpl.getColumnProperties();
631     }
632
633     /*
634      * (non-Javadoc) Method declared on Viewer.
635      */

636     public Control getControl() {
637         return tableTree;
638     }
639
640     /**
641      * Returns the element with the given index from this viewer. Returns
642      * <code>null</code> if the index is out of range.
643      * <p>
644      * This method is internal to the framework.
645      * </p>
646      *
647      * @param index
648      * the zero-based index
649      * @return the element at the given index, or <code>null</code> if the
650      * index is out of range
651      */

652     public Object JavaDoc getElementAt(int index) {
653         // XXX: Workaround for 1GBCSB1: SWT:WIN2000 - TableTree should have
654
// getItem(int index)
655
TableTreeItem i = tableTree.getItems()[index];
656         if (i != null) {
657             return i.getData();
658         }
659         return null;
660     }
661
662     /*
663      * (non-Javadoc) Method declared on AbstractTreeViewer.
664      */

665     protected boolean getExpanded(Item item) {
666         return ((TableTreeItem) item).getExpanded();
667     }
668
669     /*
670      * (non-Javadoc)
671      *
672      * @see org.eclipse.jface.viewers.ColumnViewer#getItemAt(org.eclipse.swt.graphics.Point)
673      */

674     protected Item getItemAt(Point p) {
675         return getTableTree().getTable().getItem(p);
676     }
677
678     /*
679      * (non-Javadoc) Method declared on AbstractTreeViewer.
680      */

681     protected int getItemCount(Control widget) {
682         return ((TableTree) widget).getItemCount();
683     }
684
685     /*
686      * (non-Javadoc) Method declared on AbstractTreeViewer.
687      */

688     protected int getItemCount(Item item) {
689         return ((TableTreeItem) item).getItemCount();
690     }
691
692     /*
693      * (non-Javadoc) Method declared on AbstractTreeViewer.
694      */

695     protected org.eclipse.swt.widgets.Item[] getItems(
696             org.eclipse.swt.widgets.Item item) {
697         return ((TableTreeItem) item).getItems();
698     }
699
700     /**
701      * The table tree viewer implementation of this <code>Viewer</code>
702      * framework method returns the label provider, which in the case of table
703      * tree viewers will be an instance of either
704      * <code>ITableLabelProvider</code> or <code>ILabelProvider</code>. If
705      * it is an <code>ITableLabelProvider</code>, then it provides a separate
706      * label text and image for each column. If it is an
707      * <code>ILabelProvider</code>, then it provides only the label text and
708      * image for the first column, and any remaining columns are blank.
709      */

710     public IBaseLabelProvider getLabelProvider() {
711         return super.getLabelProvider();
712     }
713
714     /*
715      * (non-Javadoc) Method declared on AbstractTreeViewer.
716      */

717     protected Item getParentItem(Item item) {
718         return ((TableTreeItem) item).getParentItem();
719     }
720
721     /*
722      * (non-Javadoc) Method declared on AbstractTreeViewer.
723      */

724     protected Item[] getSelection(Control widget) {
725         return ((TableTree) widget).getSelection();
726     }
727
728     /**
729      * Returns this table tree viewer's table tree control.
730      *
731      * @return the table tree control
732      */

733     public TableTree getTableTree() {
734         return tableTree;
735     }
736
737     /*
738      * (non-Javadoc) Method declared on AbstractTreeViewer.
739      */

740     protected void hookControl(Control control) {
741         super.hookControl(control);
742         tableTree.getTable().addMouseListener(new MouseAdapter() {
743             public void mouseDown(MouseEvent e) {
744                 /*
745                  * If user clicked on the [+] or [-], do not activate
746                  * CellEditor.
747                  */

748                 // XXX: This code should not be here. SWT should either have
749
// support to see
750
// if the user clicked on the [+]/[-] or manage the table editor
751
// activation
752
org.eclipse.swt.widgets.TableItem[] items = tableTree
753                         .getTable().getItems();
754                 for (int i = 0; i < items.length; i++) {
755                     Rectangle rect = items[i].getImageBounds(0);
756                     if (rect.contains(e.x, e.y)) {
757                         return;
758                     }
759                 }
760
761                 tableEditorImpl.handleMouseDown(e);
762             }
763         });
764     }
765
766     /**
767      * Returns whether there is an active cell editor.
768      *
769      * @return <code>true</code> if there is an active cell editor, and
770      * <code>false</code> otherwise
771      */

772     public boolean isCellEditorActive() {
773         return tableEditorImpl.isCellEditorActive();
774     }
775
776     /*
777      * (non-Javadoc) Method declared in AbstractTreeViewer.
778      */

779     protected Item newItem(Widget parent, int flags, int ix) {
780         TableTreeItem item;
781         if (ix >= 0) {
782             if (parent instanceof TableTreeItem) {
783                 item = new TableTreeItem((TableTreeItem) parent, flags, ix);
784             } else {
785                 item = new TableTreeItem((TableTree) parent, flags, ix);
786             }
787         } else {
788             if (parent instanceof TableTreeItem) {
789                 item = new TableTreeItem((TableTreeItem) parent, flags);
790             } else {
791                 item = new TableTreeItem((TableTree) parent, flags);
792             }
793         }
794         return item;
795     }
796
797     /*
798      * (non-Javadoc) Method declared in AbstractTreeViewer.
799      */

800     protected void removeAll(Control widget) {
801         ((TableTree) widget).removeAll();
802     }
803
804     /**
805      * Sets the cell editors of this table viewer.
806      *
807      * @param editors
808      * the list of cell editors
809      */

810     public void setCellEditors(CellEditor[] editors) {
811         tableEditorImpl.setCellEditors(editors);
812     }
813
814     /**
815      * Sets the cell modifier of this table viewer.
816      *
817      * @param modifier
818      * the cell modifier
819      */

820     public void setCellModifier(ICellModifier modifier) {
821         tableEditorImpl.setCellModifier(modifier);
822     }
823
824     /**
825      * Sets the column properties of this table viewer. The properties must
826      * correspond with the columns of the table control. They are used to
827      * identify the column in a cell modifier.
828      *
829      * @param columnProperties
830      * the list of column properties
831      */

832     public void setColumnProperties(String JavaDoc[] columnProperties) {
833         tableEditorImpl.setColumnProperties(columnProperties);
834     }
835
836     /*
837      * (non-Javadoc) Method declared in AbstractTreeViewer.
838      */

839     protected void setExpanded(Item node, boolean expand) {
840         ((TableTreeItem) node).setExpanded(expand);
841     }
842
843     /*
844      * (non-Javadoc) Method declared in AbstractTreeViewer.
845      */

846     protected void setSelection(List JavaDoc items) {
847         TableTreeItem[] newItems = new TableTreeItem[items.size()];
848         items.toArray(newItems);
849         getTableTree().setSelection(newItems);
850     }
851
852     /*
853      * (non-Javadoc) Method declared in AbstractTreeViewer.
854      */

855     protected void showItem(Item item) {
856         getTableTree().showItem((TableTreeItem) item);
857     }
858 }
859
Popular Tags