1 20 21 package org.apache.directory.ldapstudio.browser.ui.editors.searchresult; 22 23 24 import org.apache.directory.ldapstudio.browser.common.widgets.ViewFormWidget; 25 import org.eclipse.jface.viewers.TableViewer; 26 import org.eclipse.swt.SWT; 27 import org.eclipse.swt.layout.GridData; 28 import org.eclipse.swt.widgets.Composite; 29 import org.eclipse.swt.widgets.Control; 30 import org.eclipse.swt.widgets.Table; 31 32 33 public class SearchResultEditorWidget extends ViewFormWidget 34 { 35 36 private SearchResultEditorConfiguration configuration; 37 38 private SearchResultEditorQuickFilterWidget quickFilterWidget; 39 40 private Table table; 41 42 private TableViewer viewer; 43 44 45 public SearchResultEditorWidget( SearchResultEditorConfiguration configuration ) 46 { 47 this.configuration = configuration; 48 } 49 50 51 protected Control createContent( Composite parent ) 52 { 53 54 this.quickFilterWidget = new SearchResultEditorQuickFilterWidget( this.configuration.getFilter() ); 56 this.quickFilterWidget.createComposite( parent ); 57 58 this.table = new Table( parent, SWT.BORDER | SWT.HIDE_SELECTION | SWT.VIRTUAL ); 60 this.table.setHeaderVisible( true ); 61 this.table.setLinesVisible( true ); 62 this.table.setLayoutData( new GridData( GridData.FILL_BOTH ) ); 63 this.viewer = new TableViewer( this.table ); 64 this.viewer.setUseHashlookup( true ); 65 66 this.viewer.setContentProvider( configuration.getContentProvider( this ) ); 68 this.viewer.setLabelProvider( configuration.getLabelProvider( this.viewer ) ); 69 70 this.viewer.setCellModifier( configuration.getCellModifier( this.viewer ) ); 72 73 return this.table; 74 } 75 76 77 public void setInput( Object input ) 78 { 79 this.viewer.setInput( input ); 80 } 81 82 83 public void setFocus() 84 { 85 this.configuration.getCursor( this.viewer ).setFocus(); 86 } 87 88 89 public void dispose() 90 { 91 if ( this.viewer != null ) 92 { 93 this.configuration.dispose(); 94 95 if ( this.quickFilterWidget != null ) 96 { 97 this.quickFilterWidget.dispose(); 98 this.quickFilterWidget = null; 99 } 100 101 this.table = null; 103 this.viewer = null; 104 } 105 106 super.dispose(); 107 } 108 109 110 public TableViewer getViewer() 111 { 112 return viewer; 113 } 114 115 116 public SearchResultEditorQuickFilterWidget getQuickFilterWidget() 117 { 118 return quickFilterWidget; 119 } 120 121 } 122 | Popular Tags |