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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| private void createFormulaList(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
composite.setLayout(layout);
GridData gridData = new GridData(GridData.FILL_BOTH);
composite.setLayoutData(gridData);
Composite group = new Composite(composite, SWT.NONE);
layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
group.setLayout(layout);
gridData = new GridData(GridData.FILL_BOTH);
group.setLayoutData(gridData);
removeButton = new Button(composite, SWT.PUSH | SWT.NO_FOCUS);
removeButton.setText("Remove");
gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
removeButton.setLayoutData(gridData);
removeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
if (formulaTextList.getItems() != null) {
int[] indices = formulaTextList.getSelectionIndices();
formulaTextList.remove(indices);
for (int i = indices.length; i > 0; i--) {
formulaList.remove(indices[i - 1]);
checkBoxList.get(indices[i - 1]).dispose();
checkBoxList.remove(indices[i - 1]);
}
setUsedFormulaList(getUsedFormulaList());// MaJ graphique
initparamVectorList();
for (String string : formulaList) {
refreshParamVect(string);
}
if (formulaTextList.getItemCount() == 0) {
removeButton.setEnabled(false);
}
labelText.setText("");
removeButton.setEnabled(false);
}
}
catch (Exception ex) {
log.warn(ex, ex);
}
textFocus();
}
});
removeButton.setEnabled(false);
FormToolkit toolkit = new FormToolkit(Display.getDefault());
Section sectionConstraint = toolkit.createSection(group, ExpandableComposite.TITLE_BAR);
Section sectionConstrained = toolkit.createSection(group, ExpandableComposite.TITLE_BAR);
sectionConstraint.setText("Constraints");
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
sectionConstraint.setLayoutData(gridData);
sectionConstraint.setLayout(new GridLayout());
sectionConstrained.setText("all iterations constrained");
sectionConstrained.setLayoutData(gridData);
sectionConstrained.setLayout(new GridLayout());
formulaTextList = new List(sectionConstraint, SWT.NONE);
sectionConstraint.setClient(formulaTextList);
formulaTextList.setLayoutData(new GridData(GridData.FILL_BOTH));
formulaTextList.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String[] selection = formulaTextList.getSelection();
if (selection.length > 0) {
removeButton.setEnabled(true);
if (selection.length == 1) {
labelText.setText(selection[0]);
}
}
}
});
constraintsBoxArea = new Composite(sectionConstrained, SWT.NONE);
constraintsBoxArea.setLayoutData(new GridData(GridData.FILL_BOTH));
sectionConstrained.setClient(constraintsBoxArea);
} |
Partager