1 11 package org.eclipse.ui.internal.views.properties.tabbed.view; 12 13 import org.eclipse.swt.SWT; 14 import org.eclipse.swt.custom.ScrolledComposite; 15 import org.eclipse.swt.layout.FormAttachment; 16 import org.eclipse.swt.layout.FormData; 17 import org.eclipse.swt.layout.FormLayout; 18 import org.eclipse.swt.widgets.Composite; 19 import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; 20 21 22 27 public class TabbedPropertyComposite 28 extends Composite { 29 30 private TabbedPropertySheetWidgetFactory factory; 31 32 private Composite mainComposite; 33 34 private Composite leftComposite; 35 36 private ScrolledComposite scrolledComposite; 37 38 private Composite tabComposite; 39 40 private TabbedPropertyTitle title; 41 42 private TabbedPropertyList listComposite; 43 44 private boolean displayTitle; 45 46 56 public TabbedPropertyComposite(Composite parent, 57 TabbedPropertySheetWidgetFactory factory, boolean displayTitle) { 58 super(parent, SWT.NO_FOCUS); 59 this.factory = factory; 60 this.displayTitle = displayTitle; 61 62 createMainComposite(); 63 } 64 65 68 protected void createMainComposite() { 69 mainComposite = factory.createComposite(this, SWT.NO_FOCUS); 70 mainComposite.setLayout(new FormLayout()); 71 FormData formData = new FormData(); 72 formData.left = new FormAttachment(0, 0); 73 formData.right = new FormAttachment(100, 0); 74 formData.top = new FormAttachment(0, 0); 75 formData.bottom = new FormAttachment(100, 0); 76 mainComposite.setLayoutData(formData); 77 78 createMainContents(); 79 } 80 81 84 protected void createMainContents() { 85 if (displayTitle) { 86 title = new TabbedPropertyTitle(mainComposite, factory); 87 88 FormData data = new FormData(); 89 data.left = new FormAttachment(0, 0); 90 data.right = new FormAttachment(100, 0); 91 data.top = new FormAttachment(0, 0); 92 title.setLayoutData(data); 93 } 94 95 leftComposite = factory.createComposite(mainComposite, SWT.NO_FOCUS); 96 leftComposite.setLayout(new FormLayout()); 97 98 scrolledComposite = factory.createScrolledComposite(mainComposite, SWT.H_SCROLL 99 | SWT.V_SCROLL | SWT.NO_FOCUS); 100 scrolledComposite.setLayout(new FormLayout()); 101 102 FormData formData = new FormData(); 103 formData.left = new FormAttachment(leftComposite, 0); 104 formData.right = new FormAttachment(100, 0); 105 if (displayTitle) { 106 formData.top = new FormAttachment(title, 0); 107 } else { 108 formData.top = new FormAttachment(0, 0); 109 } 110 formData.bottom = new FormAttachment(100, 0); 111 scrolledComposite.setLayoutData(formData); 112 113 formData = new FormData(); 114 formData.left = new FormAttachment(0, 0); 115 formData.right = new FormAttachment(scrolledComposite, 0); 116 if (displayTitle) { 117 formData.top = new FormAttachment(title, 0); 118 } else { 119 formData.top = new FormAttachment(0, 0); 120 } 121 formData.bottom = new FormAttachment(100, 0); 122 leftComposite.setLayoutData(formData); 123 124 tabComposite = factory.createComposite(scrolledComposite, SWT.NO_FOCUS); 125 tabComposite.setLayout(new FormLayout()); 126 127 scrolledComposite.setContent(tabComposite); 128 scrolledComposite.setAlwaysShowScrollBars(false); 129 scrolledComposite.setExpandVertical(true); 130 scrolledComposite.setExpandHorizontal(true); 131 132 listComposite = new TabbedPropertyList(leftComposite, factory); 133 formData = new FormData(); 134 formData.left = new FormAttachment(0, 0); 135 formData.right = new FormAttachment(100, 0); 136 formData.top = new FormAttachment(0, 0); 137 formData.bottom = new FormAttachment(100, 0); 138 listComposite.setLayoutData(formData); 139 140 FormData data = new FormData(); 141 data.left = new FormAttachment(0, 0); 142 data.right = new FormAttachment(100, 0); 143 data.top = new FormAttachment(0, 0); 144 data.bottom = new FormAttachment(100, 0); 145 tabComposite.setLayoutData(data); 146 } 147 148 154 public TabbedPropertyList getList() { 155 return listComposite; 156 } 157 158 163 public TabbedPropertyTitle getTitle() { 164 return title; 165 } 166 167 172 public Composite getTabComposite() { 173 return tabComposite; 174 } 175 176 182 public ScrolledComposite getScrolledComposite() { 183 return scrolledComposite; 184 } 185 186 191 protected TabbedPropertySheetWidgetFactory getFactory() { 192 return factory; 193 } 194 195 198 public void dispose() { 199 listComposite.dispose(); 200 if (displayTitle) { 201 title.dispose(); 202 } 203 super.dispose(); 204 } 205 } 206 | Popular Tags |