1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
public class FormEdit extends ViewPart {..
public void createPartControl(Composite parent) {
final Composite compParent = parent;
toolkit = new FormToolkit(parent.getDisplay());
form = toolkit.createScrolledForm(parent);
TableWrapLayout layout = new TableWrapLayout();
layout.numColumns = 1;
form.getBody().setLayout(layout);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
form.setLayoutData(gd);
TableWrapData td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
td.grabHorizontal = true;
td.colspan = 2;
toolkit.createLabel(form.getBody(), "blabla : ");
Button buttonV3 = toolkit.createButton(form.getBody(), "V3", SWT.RADIO);
buttonV3.setSelection(true);
Button buttonV4 = toolkit.createButton(form.getBody(), "V4", SWT.RADIO);
td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
buttonV3.setLayoutData(td);
td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
buttonV4.setLayoutData(td);
Section s1 = toolkit.createSection(form.getBody(), Section.TWISTIE|Section.TITLE_BAR|Section.EXPANDED);
s1.setText("section 1");
td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
td.grabHorizontal = true;
s1.setLayoutData(td);
s1.addExpansionListener(new ExpansionAdapter() {
public void expansionStateChanged(ExpansionEvent e) {
form.reflow(true);
compParent.pack(true);
}});
...
} |
Partager