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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
|
wizard = (SetLocalWeightWizard) getWizard();
UnitSystem unitSystem = wizard.getRunnable().getUnitSystem();
int dimension = wizard.getDimension();
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
composite.setLayout(layout);
final Composite selectionComposite = new Composite(composite, SWT.NONE);
layout = new GridLayout(1, false);
selectionComposite.setLayout(layout);
selectionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Group groupFrequency = new Group(selectionComposite, SWT.NONE);
GridLayout groupLayout = new GridLayout();
groupFrequency.setLayout(groupLayout);
groupFrequency.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
frequencyButton = new Button(groupFrequency, SWT.RADIO);
frequencyButton.setText(SettingsOptions.FREQUENCY.getDescription());
frequencyButton.setSelection(true);
Composite frequencyComposite = new Composite(groupFrequency, SWT.NONE);
frequencyComposite.setLayout(new GridLayout(3, false));
frequencyText = new Text(frequencyComposite, SWT.RIGHT | SWT.BORDER);
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.minimumWidth = 70;
frequencyText.setLayoutData(gridData);
frequencyText.setTextLimit(10);
frequencyText.setText("1"); //$NON-NLS-1$
Label label = new Label(frequencyComposite, SWT.NONE);
label.setText("/"); //$NON-NLS-1$
comboFrequency = new Combo(frequencyComposite, SWT.DROP_DOWN | SWT.MULTI | SWT.V_SCROLL
| SWT.H_SCROLL | SWT.READ_ONLY);
comboFrequency.add(frequencyTime[0]);
comboFrequency.add(frequencyTime[1]);
comboFrequency.add(frequencyTime[2]);
comboFrequency.select(0);
frequencyButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
boolean isSelected = frequencyButton.getSelection();
frequencyText.setEnabled(isSelected);
comboFrequency.setEnabled(isSelected);
dateBeginChooser.setEnabled(!isSelected);
dateEndChooser.setEnabled(!isSelected);
timeIntervalButton.setSelection(!isSelected);
propertyIntervalButton.setSelection(!isSelected);
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
final Group groupTime = new Group(selectionComposite, SWT.NONE);
groupLayout = new GridLayout();
groupTime.setLayout(groupLayout);
groupTime.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.minimumWidth = 150;
timeIntervalButton = new Button(groupTime, SWT.RADIO);
timeIntervalButton.setText(SettingsOptions.TIME.getDescription());
timeIntervalButton.setSelection(false);
timeIntervalButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
boolean isSelected = timeIntervalButton.getSelection();
dateBeginChooser.setEnabled(isSelected);
dateEndChooser.setEnabled(isSelected);
propertyMinText.setEnabled(!isSelected);
propertyMaxText.setEnabled(!isSelected);
frequencyText.setEnabled(!isSelected);
comboFrequency.setEnabled(!isSelected);
frequencyButton.setSelection(!isSelected);
propertyIntervalButton.setSelection(!isSelected);
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
ScrolledComposite scrolledComposite = new ScrolledComposite(groupTime, SWT.H_SCROLL
| SWT.NO_FOCUS);
scrolledComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
scrolledComposite.setLayout(groupLayout);
final Composite timeComposite = new Composite(scrolledComposite, SWT.NONE);
layout = new GridLayout(compteurLayout, false);
timeComposite.setLayout(layout);
timeComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label dateBeginLabel = new Label(timeComposite, SWT.NONE);
dateBeginLabel.setText(AutomatedHistoryMatchMessages.SetLocalWeightWizardPage_label_begin);
dateBeginChooser = new SwtComboCalendar(timeComposite, SWT.NONE, TimeZone
.getTimeZone("GMT")); //$NON-NLS-1$
dateBeginChooser.setLayoutData(gridData);
dateBeginChooser.setDate(dateMin);
Label maximumLabel = new Label(timeComposite, SWT.NONE);
maximumLabel.setText(AutomatedHistoryMatchMessages.SetLocalWeightWizardPage_label_end);
dateEndChooser = new SwtComboCalendar(timeComposite, SWT.NONE, TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
dateEndChooser.setLayoutData(gridData);
dateEndChooser.setDate(dateMax);
scrolledComposite.setMinSize(timeComposite.getSize());
scrolledComposite.setAlwaysShowScrollBars(false);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setContent(timeComposite);
Button boutonAddInterval = new Button(groupTime, SWT.NONE);
boutonAddInterval.setText("Add a new interval");
boutonAddInterval.setLayoutData(gridData);
boutonAddInterval.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
// TODO Auto-generated method stub
GridData gridData = new GridData();
compteurLayout = compteurLayout + 2;
GridLayout layout = new GridLayout(compteurLayout, false);
timeComposite.setLayout(layout);
timeComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label dateBeginLabel = new Label(timeComposite, SWT.NONE);
dateBeginLabel
.setText(AutomatedHistoryMatchMessages.SetLocalWeightWizardPage_label_begin);
SwtComboCalendar dateBeginChooserbis = new SwtComboCalendar(timeComposite,
SWT.NONE, TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
dateBeginChooserbis.setLayoutData(gridData);
dateBeginChooserbis.setDate(dateMin);
Label maximumLabel = new Label(timeComposite, SWT.NONE);
maximumLabel
.setText(AutomatedHistoryMatchMessages.SetLocalWeightWizardPage_label_end);
SwtComboCalendar dateEndChooserbis = new SwtComboCalendar(timeComposite, SWT.NONE,
TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
dateEndChooserbis.setLayoutData(gridData);
dateEndChooserbis.setDate(dateMax);
timeComposite.layout();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
});
timeIntervalButton.setSelection(false);
dateBeginChooser.setEnabled(false);
dateEndChooser.setEnabled(false);
Group groupProperty = new Group(selectionComposite, SWT.NONE);
groupLayout = new GridLayout();
groupProperty.setLayout(groupLayout);
groupProperty.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
propertyIntervalButton = new Button(groupProperty, SWT.RADIO);
propertyIntervalButton.setText(SettingsOptions.PROPERTY.getDescription());
propertyIntervalButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
boolean isSelected = propertyIntervalButton.getSelection();
propertyMinText.setEnabled(isSelected);
propertyMaxText.setEnabled(isSelected);
dateBeginChooser.setEnabled(!isSelected);
dateEndChooser.setEnabled(!isSelected);
frequencyText.setEnabled(!isSelected);
comboFrequency.setEnabled(!isSelected);
frequencyButton.setSelection(!isSelected);
timeIntervalButton.setSelection(!isSelected);
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
Composite propertyComposite = new Composite(groupProperty, SWT.NONE);
layout = new GridLayout(2, false);
propertyComposite.setLayout(layout);
propertyComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label propertyMinLabel = new Label(propertyComposite, SWT.NONE);
propertyMinLabel
.setText(AutomatedHistoryMatchMessages.SetLocalWeightWizardPage_label_minimum);
propertyMinText = new Text(propertyComposite, SWT.FLAT | SWT.BORDER);
propertyMinText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
propertyMinText.setLayoutData(gridData);
propertyMinText.setText("" + unitSystem.fromSI(dimension, propertyMin)); //$NON-NLS-1$
Label propertyMaxLabel = new Label(propertyComposite, SWT.NONE);
propertyMaxLabel
.setText(AutomatedHistoryMatchMessages.SetLocalWeightWizardPage_label_maximum);
propertyMaxText = new Text(propertyComposite, SWT.FLAT | SWT.BORDER);
propertyMaxText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
propertyMaxText.setLayoutData(gridData);
propertyMaxText.setText("" + unitSystem.fromSI(dimension, propertyMax)); //$NON-NLS-1$
propertyIntervalButton.setSelection(false);
propertyMinText.setEnabled(false);
propertyMaxText.setEnabled(false);
setControl(composite); |
Partager