|
Lines 149-162
Link Here
|
| 149 |
* {@link #enableWidgets(boolean)} is called. |
149 |
* {@link #enableWidgets(boolean)} is called. |
| 150 |
*/ |
150 |
*/ |
| 151 |
private ArrayList<Control> managedWidgets; |
151 |
private ArrayList<Control> managedWidgets; |
| 152 |
|
152 |
|
| 153 |
/** |
153 |
/** |
| 154 |
* The collection of <code>Pane</code>s that are displayed in this pane, |
154 |
* The collection of <code>Pane</code>s that are displayed in this pane, |
| 155 |
* which will have their enablement state updated when |
155 |
* which will have their enablement state updated when |
| 156 |
* {@link #enableWidgets(boolean)} is called. |
156 |
* {@link #enableWidgets(boolean)} is called. |
| 157 |
*/ |
157 |
*/ |
| 158 |
private ArrayList<Pane<?>> managedSubPanes; |
158 |
private ArrayList<Pane<?>> managedSubPanes; |
| 159 |
|
159 |
|
| 160 |
/** |
160 |
/** |
| 161 |
* This enabled model is used to store the pane's base enablement state. |
161 |
* This enabled model is used to store the pane's base enablement state. |
| 162 |
* If API is called to set the pane enabled, this model gets updated. If the pane is thereby |
162 |
* If API is called to set the pane enabled, this model gets updated. If the pane is thereby |
|
Lines 164-188
Link Here
|
| 164 |
* enabled. |
164 |
* enabled. |
| 165 |
* @see #getCombinedEnabledModel() |
165 |
* @see #getCombinedEnabledModel() |
| 166 |
*/ |
166 |
*/ |
| 167 |
private final WritablePropertyValueModel<Boolean> baseEnabledModel |
167 |
private final WritablePropertyValueModel<Boolean> baseEnabledModel |
| 168 |
= new SimplePropertyValueModel<Boolean>(Boolean.TRUE); |
168 |
= new SimplePropertyValueModel<Boolean>(Boolean.TRUE); |
| 169 |
|
169 |
|
| 170 |
/** |
170 |
/** |
| 171 |
* This enabled model is used to define the pane's enablement as controlled by other widgets, |
171 |
* This enabled model is used to define the pane's enablement as controlled by other widgets, |
| 172 |
* tests, etc. (for example a radio button) |
172 |
* tests, etc. (for example a radio button) |
| 173 |
* If this model is changed, and the pane is thereby fully enabled (base enabled model is also |
173 |
* If this model is changed, and the pane is thereby fully enabled (base enabled model is also |
| 174 |
* in agreement) the pane's widgets are set enabled. |
174 |
* in agreement) the pane's widgets are set enabled. |
| 175 |
* @see #getCombinedEnabledModel() |
175 |
* @see #getCombinedEnabledModel() |
| 176 |
*/ |
176 |
*/ |
| 177 |
private PropertyValueModel<Boolean> controllerEnabledModel; |
177 |
private PropertyValueModel<Boolean> controllerEnabledModel; |
| 178 |
|
178 |
|
| 179 |
/** |
179 |
/** |
| 180 |
* The "and" combination of {@link #baseEnabledModel} and {@link #controllerEnabledModel} |
180 |
* The "and" combination of {@link #baseEnabledModel} and {@link #controllerEnabledModel} |
| 181 |
*/ |
181 |
*/ |
| 182 |
private PropertyValueModel<Boolean> combinedEnabledModel; |
182 |
private PropertyValueModel<Boolean> combinedEnabledModel; |
| 183 |
|
183 |
|
| 184 |
private PropertyChangeListener combinedEnabledModelListener; |
184 |
private PropertyChangeListener combinedEnabledModelListener; |
| 185 |
|
185 |
|
| 186 |
/** |
186 |
/** |
| 187 |
* Creates a new <code>Pane</code>. |
187 |
* Creates a new <code>Pane</code>. |
| 188 |
* |
188 |
* |
|
Lines 194-200
Link Here
|
| 194 |
protected Pane( |
194 |
protected Pane( |
| 195 |
Pane<? extends T> parentPane, |
195 |
Pane<? extends T> parentPane, |
| 196 |
Composite parent) { |
196 |
Composite parent) { |
| 197 |
|
197 |
|
| 198 |
this(parentPane, parent, true); |
198 |
this(parentPane, parent, true); |
| 199 |
} |
199 |
} |
| 200 |
|
200 |
|
|
Lines 214-220
Link Here
|
| 214 |
Pane<? extends T> parentPane, |
214 |
Pane<? extends T> parentPane, |
| 215 |
Composite parent, |
215 |
Composite parent, |
| 216 |
boolean automaticallyAlignWidgets) { |
216 |
boolean automaticallyAlignWidgets) { |
| 217 |
|
217 |
|
| 218 |
this( |
218 |
this( |
| 219 |
parentPane, |
219 |
parentPane, |
| 220 |
parentPane.getSubjectHolder(), |
220 |
parentPane.getSubjectHolder(), |
|
Lines 239-245
Link Here
|
| 239 |
Composite parent, |
239 |
Composite parent, |
| 240 |
boolean automaticallyAlignWidgets, |
240 |
boolean automaticallyAlignWidgets, |
| 241 |
boolean parentManagePane) { |
241 |
boolean parentManagePane) { |
| 242 |
|
242 |
|
| 243 |
this( |
243 |
this( |
| 244 |
parentPane, |
244 |
parentPane, |
| 245 |
parentPane.getSubjectHolder(), |
245 |
parentPane.getSubjectHolder(), |
|
Lines 261-276
Link Here
|
| 261 |
Pane<?> parentPane, |
261 |
Pane<?> parentPane, |
| 262 |
PropertyValueModel<? extends T> subjectHolder, |
262 |
PropertyValueModel<? extends T> subjectHolder, |
| 263 |
Composite parent) { |
263 |
Composite parent) { |
| 264 |
|
264 |
|
| 265 |
this(parentPane, subjectHolder, parent, true); |
265 |
this(parentPane, subjectHolder, parent, true); |
| 266 |
} |
266 |
} |
| 267 |
|
267 |
|
| 268 |
protected Pane( |
268 |
protected Pane( |
| 269 |
Pane<?> parentPane, |
269 |
Pane<?> parentPane, |
| 270 |
PropertyValueModel<? extends T> subjectHolder, |
270 |
PropertyValueModel<? extends T> subjectHolder, |
| 271 |
Composite parent, |
271 |
Composite parent, |
| 272 |
PropertyValueModel<Boolean> enabledModel) { |
272 |
PropertyValueModel<Boolean> enabledModel) { |
| 273 |
|
273 |
|
| 274 |
this(parentPane, subjectHolder, parent, true, enabledModel); |
274 |
this(parentPane, subjectHolder, parent, true, enabledModel); |
| 275 |
} |
275 |
} |
| 276 |
|
276 |
|
|
Lines 292-311
Link Here
|
| 292 |
PropertyValueModel<? extends T> subjectHolder, |
292 |
PropertyValueModel<? extends T> subjectHolder, |
| 293 |
Composite parent, |
293 |
Composite parent, |
| 294 |
boolean automaticallyAlignWidgets) { |
294 |
boolean automaticallyAlignWidgets) { |
| 295 |
|
295 |
|
| 296 |
this(parentPane, subjectHolder, parent, automaticallyAlignWidgets, true); |
296 |
this(parentPane, subjectHolder, parent, automaticallyAlignWidgets, true); |
| 297 |
} |
297 |
} |
| 298 |
|
298 |
|
| 299 |
protected Pane( |
299 |
protected Pane( |
| 300 |
Pane<?> parentPane, |
300 |
Pane<?> parentPane, |
| 301 |
PropertyValueModel<? extends T> subjectHolder, |
301 |
PropertyValueModel<? extends T> subjectHolder, |
| 302 |
Composite parent, |
302 |
Composite parent, |
| 303 |
boolean automaticallyAlignWidgets, |
303 |
boolean automaticallyAlignWidgets, |
| 304 |
PropertyValueModel<Boolean> enabledModel) { |
304 |
PropertyValueModel<Boolean> enabledModel) { |
| 305 |
|
305 |
|
| 306 |
this(parentPane, subjectHolder, parent, automaticallyAlignWidgets, true, enabledModel); |
306 |
this(parentPane, subjectHolder, parent, automaticallyAlignWidgets, true, enabledModel); |
| 307 |
} |
307 |
} |
| 308 |
|
308 |
|
| 309 |
/** |
309 |
/** |
| 310 |
* Creates a new <code>Pane</code>. |
310 |
* Creates a new <code>Pane</code>. |
| 311 |
* |
311 |
* |
|
Lines 325-350
Link Here
|
| 325 |
Pane<?> parentPane, |
325 |
Pane<?> parentPane, |
| 326 |
PropertyValueModel<? extends T> subjectHolder, |
326 |
PropertyValueModel<? extends T> subjectHolder, |
| 327 |
Composite parent, |
327 |
Composite parent, |
| 328 |
boolean automaticallyAlignWidgets, |
328 |
boolean automaticallyAlignWidgets, |
| 329 |
boolean parentManagePane) { |
329 |
boolean parentManagePane) { |
| 330 |
|
330 |
|
| 331 |
this(subjectHolder, parent, parentPane.getWidgetFactory()); |
331 |
this(subjectHolder, parent, parentPane.getWidgetFactory()); |
| 332 |
this.initialize(parentPane, automaticallyAlignWidgets, parentManagePane); |
332 |
this.initialize(parentPane, automaticallyAlignWidgets, parentManagePane); |
| 333 |
} |
333 |
} |
| 334 |
|
334 |
|
| 335 |
protected Pane( |
335 |
protected Pane( |
| 336 |
Pane<?> parentPane, |
336 |
Pane<?> parentPane, |
| 337 |
PropertyValueModel<? extends T> subjectHolder, |
337 |
PropertyValueModel<? extends T> subjectHolder, |
| 338 |
Composite parent, |
338 |
Composite parent, |
| 339 |
boolean automaticallyAlignWidgets, |
339 |
boolean automaticallyAlignWidgets, |
| 340 |
boolean parentManagePane, |
340 |
boolean parentManagePane, |
| 341 |
PropertyValueModel<Boolean> enabledModel) { |
341 |
PropertyValueModel<Boolean> enabledModel) { |
| 342 |
|
342 |
|
| 343 |
this(subjectHolder, parent, parentPane.getWidgetFactory()); |
343 |
this(subjectHolder, parent, parentPane.getWidgetFactory()); |
| 344 |
this.initialize(parentPane, automaticallyAlignWidgets, parentManagePane); |
344 |
this.initialize(parentPane, automaticallyAlignWidgets, parentManagePane); |
| 345 |
this.initializeEnabledModel(enabledModel); |
345 |
this.initializeEnabledModel(enabledModel); |
| 346 |
} |
346 |
} |
| 347 |
|
347 |
|
| 348 |
/** |
348 |
/** |
| 349 |
* Creates a new <code>Pane</code>. |
349 |
* Creates a new <code>Pane</code>. |
| 350 |
* |
350 |
* |
|
Lines 358-364
Link Here
|
| 358 |
PropertyValueModel<? extends T> subjectHolder, |
358 |
PropertyValueModel<? extends T> subjectHolder, |
| 359 |
Composite parent, |
359 |
Composite parent, |
| 360 |
WidgetFactory widgetFactory) { |
360 |
WidgetFactory widgetFactory) { |
| 361 |
|
361 |
|
| 362 |
super(); |
362 |
super(); |
| 363 |
this.initialize(subjectHolder, widgetFactory); |
363 |
this.initialize(subjectHolder, widgetFactory); |
| 364 |
this.container = this.addContainer(parent); |
364 |
this.container = this.addContainer(parent); |
|
Lines 375-381
Link Here
|
| 375 |
private void initialize( |
375 |
private void initialize( |
| 376 |
PropertyValueModel<? extends T> subjectHolder, |
376 |
PropertyValueModel<? extends T> subjectHolder, |
| 377 |
WidgetFactory widgetFactory) { |
377 |
WidgetFactory widgetFactory) { |
| 378 |
|
378 |
|
| 379 |
Assert.isNotNull(subjectHolder, "The subject holder cannot be null"); |
379 |
Assert.isNotNull(subjectHolder, "The subject holder cannot be null"); |
| 380 |
|
380 |
|
| 381 |
this.subjectHolder = (PropertyValueModel<T>) subjectHolder; |
381 |
this.subjectHolder = (PropertyValueModel<T>) subjectHolder; |
|
Lines 387-393
Link Here
|
| 387 |
this.rightControlAligner = new ControlAligner(); |
387 |
this.rightControlAligner = new ControlAligner(); |
| 388 |
this.subjectChangeListener = this.buildSubjectChangeListener(); |
388 |
this.subjectChangeListener = this.buildSubjectChangeListener(); |
| 389 |
this.aspectChangeListener = this.buildAspectChangeListener(); |
389 |
this.aspectChangeListener = this.buildAspectChangeListener(); |
| 390 |
|
390 |
|
| 391 |
this.initialize(); |
391 |
this.initialize(); |
| 392 |
} |
392 |
} |
| 393 |
|
393 |
|
|
Lines 411-426
Link Here
|
| 411 |
Pane<?> parentPane, |
411 |
Pane<?> parentPane, |
| 412 |
boolean automaticallyAlignWidgets, |
412 |
boolean automaticallyAlignWidgets, |
| 413 |
boolean parentManagePane) { |
413 |
boolean parentManagePane) { |
| 414 |
|
414 |
|
| 415 |
// Register this pane with the parent pane, it will call the methods |
415 |
// Register this pane with the parent pane, it will call the methods |
| 416 |
// automatically (engageListeners(), disengageListeners(), populate(), |
416 |
// automatically (engageListeners(), disengageListeners(), populate(), |
| 417 |
// dispose(), etc) |
417 |
// dispose(), etc) |
| 418 |
parentPane.registerSubPane(this); |
418 |
parentPane.registerSubPane(this); |
| 419 |
|
419 |
|
| 420 |
if (parentManagePane) { |
420 |
if (parentManagePane) { |
| 421 |
parentPane.manageSubPane(this); |
421 |
parentPane.manageSubPane(this); |
| 422 |
} |
422 |
} |
| 423 |
|
423 |
|
| 424 |
// Align the left and right controls with the controls from the parent |
424 |
// Align the left and right controls with the controls from the parent |
| 425 |
// pane |
425 |
// pane |
| 426 |
if (automaticallyAlignWidgets) { |
426 |
if (automaticallyAlignWidgets) { |
|
Lines 428-448
Link Here
|
| 428 |
parentPane.addAlignRight(this); |
428 |
parentPane.addAlignRight(this); |
| 429 |
} |
429 |
} |
| 430 |
} |
430 |
} |
| 431 |
|
431 |
|
| 432 |
private void initializeEnabledModel(PropertyValueModel<Boolean> enabledModel) { |
432 |
private void initializeEnabledModel(PropertyValueModel<Boolean> enabledModel) { |
| 433 |
this.controllerEnabledModel = enabledModel; |
433 |
this.controllerEnabledModel = enabledModel; |
| 434 |
this.combinedEnabledModel = |
434 |
this.combinedEnabledModel = |
| 435 |
CompositeBooleanPropertyValueModel.and(this.baseEnabledModel, this.controllerEnabledModel); |
435 |
CompositeBooleanPropertyValueModel.and(this.baseEnabledModel, this.controllerEnabledModel); |
| 436 |
this.combinedEnabledModelListener = buildCombinedEnabledModelListener(); |
436 |
this.combinedEnabledModelListener = buildCombinedEnabledModelListener(); |
| 437 |
this.combinedEnabledModel.addPropertyChangeListener( |
437 |
this.combinedEnabledModel.addPropertyChangeListener( |
| 438 |
PropertyValueModel.VALUE, this.combinedEnabledModelListener); |
438 |
PropertyValueModel.VALUE, this.combinedEnabledModelListener); |
| 439 |
enableWidgets_(getCombinedEnablement()); |
439 |
enableWidgets_(getCombinedEnablement()); |
| 440 |
} |
440 |
} |
| 441 |
|
441 |
|
| 442 |
private PropertyChangeListener buildCombinedEnabledModelListener() { |
442 |
private PropertyChangeListener buildCombinedEnabledModelListener() { |
| 443 |
return new SWTPropertyChangeListenerWrapper(buildControllerEnabledModelListener_()); |
443 |
return new SWTPropertyChangeListenerWrapper(buildControllerEnabledModelListener_()); |
| 444 |
} |
444 |
} |
| 445 |
|
445 |
|
| 446 |
private PropertyChangeListener buildControllerEnabledModelListener_() { |
446 |
private PropertyChangeListener buildControllerEnabledModelListener_() { |
| 447 |
return new PropertyChangeListener() { |
447 |
return new PropertyChangeListener() { |
| 448 |
@SuppressWarnings("unchecked") |
448 |
@SuppressWarnings("unchecked") |
|
Lines 451-457
Link Here
|
| 451 |
} |
451 |
} |
| 452 |
}; |
452 |
}; |
| 453 |
} |
453 |
} |
| 454 |
|
454 |
|
| 455 |
/** |
455 |
/** |
| 456 |
* Initializes the layout of this pane. |
456 |
* Initializes the layout of this pane. |
| 457 |
* |
457 |
* |
|
Lines 467-473
Link Here
|
| 467 |
} |
467 |
} |
| 468 |
this.managedWidgets.add(control); |
468 |
this.managedWidgets.add(control); |
| 469 |
} |
469 |
} |
| 470 |
|
470 |
|
| 471 |
private void manageSubPane(Pane<?> subPane) { |
471 |
private void manageSubPane(Pane<?> subPane) { |
| 472 |
if (this.managedSubPanes.contains(subPane)) { |
472 |
if (this.managedSubPanes.contains(subPane)) { |
| 473 |
throw new IllegalStateException(); |
473 |
throw new IllegalStateException(); |
|
Lines 585-594
Link Here
|
| 585 |
|
585 |
|
| 586 |
return this.addButton(container, text, null, buttonAction); |
586 |
return this.addButton(container, text, null, buttonAction); |
| 587 |
} |
587 |
} |
| 588 |
|
588 |
|
| 589 |
/** |
589 |
/** |
| 590 |
* Creates a new unmanaged <code>Button</code> widget. Unmanaged means |
590 |
* Creates a new unmanaged <code>Button</code> widget. Unmanaged means |
| 591 |
* that this Pane will not handle the enabling/disabling of this widget. |
591 |
* that this Pane will not handle the enabling/disabling of this widget. |
| 592 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
592 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
| 593 |
* |
593 |
* |
| 594 |
* @param parent The parent container |
594 |
* @param parent The parent container |
|
Lines 626-635
Link Here
|
| 626 |
|
626 |
|
| 627 |
return button; |
627 |
return button; |
| 628 |
} |
628 |
} |
| 629 |
|
629 |
|
| 630 |
/** |
630 |
/** |
| 631 |
* Creates a new unmanaged <code>Button</code> widget. Unmanaged means |
631 |
* Creates a new unmanaged <code>Button</code> widget. Unmanaged means |
| 632 |
* that this Pane will not handle the enabling/disabling of this widget. |
632 |
* that this Pane will not handle the enabling/disabling of this widget. |
| 633 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
633 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
| 634 |
* |
634 |
* |
| 635 |
* @param parent The parent container |
635 |
* @param parent The parent container |
|
Lines 697-703
Link Here
|
| 697 |
String buttonText, |
697 |
String buttonText, |
| 698 |
WritablePropertyValueModel<Boolean> booleanHolder, |
698 |
WritablePropertyValueModel<Boolean> booleanHolder, |
| 699 |
String helpId) { |
699 |
String helpId) { |
| 700 |
|
700 |
|
| 701 |
return this.addToggleButton( |
701 |
return this.addToggleButton( |
| 702 |
parent, |
702 |
parent, |
| 703 |
buttonText, |
703 |
buttonText, |
|
Lines 705-723
Link Here
|
| 705 |
helpId, |
705 |
helpId, |
| 706 |
SWT.CHECK); |
706 |
SWT.CHECK); |
| 707 |
} |
707 |
} |
| 708 |
|
708 |
|
| 709 |
protected final Button addCheckBox( |
709 |
protected final Button addCheckBox( |
| 710 |
Composite parent, |
710 |
Composite parent, |
| 711 |
String buttonText, |
711 |
String buttonText, |
| 712 |
WritablePropertyValueModel<Boolean> booleanHolder, |
712 |
WritablePropertyValueModel<Boolean> booleanHolder, |
| 713 |
String helpId, |
713 |
String helpId, |
| 714 |
PropertyValueModel<Boolean> enabledModel) { |
714 |
PropertyValueModel<Boolean> enabledModel) { |
| 715 |
|
715 |
|
| 716 |
Button button = this.addUnmanagedToggleButton(parent, buttonText, booleanHolder, helpId, SWT.CHECK); |
716 |
Button button = this.addUnmanagedToggleButton(parent, buttonText, booleanHolder, helpId, SWT.CHECK); |
| 717 |
this.controlEnabledState(enabledModel, button); |
717 |
this.controlEnabledState(enabledModel, button); |
| 718 |
return button; |
718 |
return button; |
| 719 |
} |
719 |
} |
| 720 |
|
720 |
|
| 721 |
/** |
721 |
/** |
| 722 |
* Creates a new <code>Section</code> that can be collapsed. A sub-pane is |
722 |
* Creates a new <code>Section</code> that can be collapsed. A sub-pane is |
| 723 |
* automatically added as its client and is the returned <code>Composite</code>. |
723 |
* automatically added as its client and is the returned <code>Composite</code>. |
|
Lines 731-743
Link Here
|
| 731 |
protected final Composite addCollapsibleSection( |
731 |
protected final Composite addCollapsibleSection( |
| 732 |
Composite container, |
732 |
Composite container, |
| 733 |
String sectionText) { |
733 |
String sectionText) { |
| 734 |
|
734 |
|
| 735 |
return this.addCollapsibleSection( |
735 |
return this.addCollapsibleSection( |
| 736 |
container, |
736 |
container, |
| 737 |
sectionText, |
737 |
sectionText, |
| 738 |
new SimplePropertyValueModel<Boolean>(Boolean.FALSE)); |
738 |
new SimplePropertyValueModel<Boolean>(Boolean.FALSE)); |
| 739 |
} |
739 |
} |
| 740 |
|
740 |
|
| 741 |
/** |
741 |
/** |
| 742 |
* Creates a new <code>Section</code> that can be collapsed. A sub-pane is |
742 |
* Creates a new <code>Section</code> that can be collapsed. A sub-pane is |
| 743 |
* automatically added as its client and is the returned <code>Composite</code>. |
743 |
* automatically added as its client and is the returned <code>Composite</code>. |
|
Lines 778-787
Link Here
|
| 778 |
String sectionText, |
778 |
String sectionText, |
| 779 |
int type, |
779 |
int type, |
| 780 |
PropertyValueModel<Boolean> expandedStateHolder) { |
780 |
PropertyValueModel<Boolean> expandedStateHolder) { |
| 781 |
|
781 |
|
| 782 |
return addCollapsibleSection(container, sectionText, null, type, expandedStateHolder); |
782 |
return addCollapsibleSection(container, sectionText, null, type, expandedStateHolder); |
| 783 |
} |
783 |
} |
| 784 |
|
784 |
|
| 785 |
/** |
785 |
/** |
| 786 |
* Creates a new <code>Section</code>. A sub-pane is automatically added as |
786 |
* Creates a new <code>Section</code>. A sub-pane is automatically added as |
| 787 |
* its client and is the returned <code>Composite</code>. |
787 |
* its client and is the returned <code>Composite</code>. |
|
Lines 847-853
Link Here
|
| 847 |
expandedStateHolder |
847 |
expandedStateHolder |
| 848 |
); |
848 |
); |
| 849 |
} |
849 |
} |
| 850 |
|
850 |
|
| 851 |
/** |
851 |
/** |
| 852 |
* Creates a new <code>Section</code>. A sub-pane is automatically added as |
852 |
* Creates a new <code>Section</code>. A sub-pane is automatically added as |
| 853 |
* its client and is the returned <code>Composite</code>. |
853 |
* its client and is the returned <code>Composite</code>. |
|
Lines 991-997
Link Here
|
| 991 |
WritablePropertyValueModel<V> selectedItemHolder, |
991 |
WritablePropertyValueModel<V> selectedItemHolder, |
| 992 |
StringConverter<V> stringConverter, |
992 |
StringConverter<V> stringConverter, |
| 993 |
PropertyValueModel<Boolean> enabledModel) { |
993 |
PropertyValueModel<Boolean> enabledModel) { |
| 994 |
|
994 |
|
| 995 |
Combo combo = this.addUnmanagedCombo(container, listHolder, selectedItemHolder, stringConverter); |
995 |
Combo combo = this.addUnmanagedCombo(container, listHolder, selectedItemHolder, stringConverter); |
| 996 |
this.controlEnabledState(enabledModel, combo); |
996 |
this.controlEnabledState(enabledModel, combo); |
| 997 |
return combo; |
997 |
return combo; |
|
Lines 1029-1056
Link Here
|
| 1029 |
protected Composite addContainer(Composite parent) { |
1029 |
protected Composite addContainer(Composite parent) { |
| 1030 |
return this.addSubPane(parent); |
1030 |
return this.addSubPane(parent); |
| 1031 |
} |
1031 |
} |
| 1032 |
|
1032 |
|
| 1033 |
protected final <V> Combo addEditableCombo( |
1033 |
protected final <V> Combo addEditableCombo( |
| 1034 |
Composite container, |
1034 |
Composite container, |
| 1035 |
ListValueModel<V> listHolder, |
1035 |
ListValueModel<V> listHolder, |
| 1036 |
WritablePropertyValueModel<V> selectedItemHolder, |
1036 |
WritablePropertyValueModel<V> selectedItemHolder, |
| 1037 |
StringConverter<V> stringConverter, |
1037 |
StringConverter<V> stringConverter, |
| 1038 |
PropertyValueModel<Boolean> enabledModel) { |
1038 |
PropertyValueModel<Boolean> enabledModel) { |
| 1039 |
|
1039 |
|
| 1040 |
Combo combo = this.addUnmanagedEditableCombo(container, listHolder, selectedItemHolder, stringConverter); |
1040 |
Combo combo = this.addUnmanagedEditableCombo(container, listHolder, selectedItemHolder, stringConverter); |
| 1041 |
this.controlEnabledState(enabledModel, combo); |
1041 |
this.controlEnabledState(enabledModel, combo); |
| 1042 |
return combo; |
1042 |
return combo; |
| 1043 |
} |
1043 |
} |
| 1044 |
|
1044 |
|
| 1045 |
protected final Combo addEditableCombo( |
1045 |
protected final Combo addEditableCombo( |
| 1046 |
Composite container) { |
1046 |
Composite container) { |
| 1047 |
|
1047 |
|
| 1048 |
Combo combo = this.widgetFactory.createEditableCombo(container); |
1048 |
Combo combo = this.widgetFactory.createEditableCombo(container); |
| 1049 |
combo.setLayoutData(getFieldGridData()); |
1049 |
combo.setLayoutData(getFieldGridData()); |
| 1050 |
this.manageWidget(combo); |
1050 |
this.manageWidget(combo); |
| 1051 |
return combo; |
1051 |
return combo; |
| 1052 |
} |
1052 |
} |
| 1053 |
|
1053 |
|
| 1054 |
/** |
1054 |
/** |
| 1055 |
* Creates a new editable <code>Combo</code>. |
1055 |
* Creates a new editable <code>Combo</code>. |
| 1056 |
* |
1056 |
* |
|
Lines 1159-1165
Link Here
|
| 1159 |
*/ |
1159 |
*/ |
| 1160 |
protected final Label addLabel(Composite container, |
1160 |
protected final Label addLabel(Composite container, |
| 1161 |
String labelText) { |
1161 |
String labelText) { |
| 1162 |
|
1162 |
|
| 1163 |
Label label = addUnmanagedLabel(container, labelText); |
1163 |
Label label = addUnmanagedLabel(container, labelText); |
| 1164 |
manageWidget(label); |
1164 |
manageWidget(label); |
| 1165 |
return label; |
1165 |
return label; |
|
Lines 1176-1183
Link Here
|
| 1176 |
} |
1176 |
} |
| 1177 |
|
1177 |
|
| 1178 |
/** |
1178 |
/** |
| 1179 |
* Creates a new unmanaged <code>Label</code> widget. Unmanaged means |
1179 |
* Creates a new unmanaged <code>Label</code> widget. Unmanaged means |
| 1180 |
* that this Pane will not handle the enabling/disabling of this widget. |
1180 |
* that this Pane will not handle the enabling/disabling of this widget. |
| 1181 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
1181 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
| 1182 |
* |
1182 |
* |
| 1183 |
* @param parent The parent container |
1183 |
* @param parent The parent container |
|
Lines 1201-1207
Link Here
|
| 1201 |
* @param selectedItemHolder The holder of the selected item |
1201 |
* @param selectedItemHolder The holder of the selected item |
| 1202 |
* @param rightControl The control shown to the right of the main widget |
1202 |
* @param rightControl The control shown to the right of the main widget |
| 1203 |
* @param helpId The topic help ID to be registered for the given center |
1203 |
* @param helpId The topic help ID to be registered for the given center |
| 1204 |
* compositer |
1204 |
* composite |
| 1205 |
* @return The container of the label and the given center control |
1205 |
* @return The container of the label and the given center control |
| 1206 |
* |
1206 |
* |
| 1207 |
* @category Layout |
1207 |
* @category Layout |
|
Lines 1241-1247
Link Here
|
| 1241 |
* @param listHolder The <code>ListValueHolder</code> |
1241 |
* @param listHolder The <code>ListValueHolder</code> |
| 1242 |
* @param selectedItemHolder The holder of the selected item |
1242 |
* @param selectedItemHolder The holder of the selected item |
| 1243 |
* @param helpId The topic help ID to be registered for the given center |
1243 |
* @param helpId The topic help ID to be registered for the given center |
| 1244 |
* compositer |
1244 |
* composite |
| 1245 |
* @return The container of the label and the given center control |
1245 |
* @return The container of the label and the given center control |
| 1246 |
* |
1246 |
* |
| 1247 |
* @category Layout |
1247 |
* @category Layout |
|
Lines 1273-1279
Link Here
|
| 1273 |
* @param centerControl The main widget |
1273 |
* @param centerControl The main widget |
| 1274 |
* @param rightControl The control shown to the right of the main widget |
1274 |
* @param rightControl The control shown to the right of the main widget |
| 1275 |
* @param helpId The topic help ID to be registered for the given center |
1275 |
* @param helpId The topic help ID to be registered for the given center |
| 1276 |
* compositer |
1276 |
* composite |
| 1277 |
* @return The container of the label and the given center control |
1277 |
* @return The container of the label and the given center control |
| 1278 |
* |
1278 |
* |
| 1279 |
* @category Layout |
1279 |
* @category Layout |
|
Lines 1330-1336
Link Here
|
| 1330 |
|
1330 |
|
| 1331 |
return container; |
1331 |
return container; |
| 1332 |
} |
1332 |
} |
| 1333 |
|
1333 |
|
| 1334 |
/** |
1334 |
/** |
| 1335 |
* Creates a new container that will have the given center control labeled |
1335 |
* Creates a new container that will have the given center control labeled |
| 1336 |
* with the given label. |
1336 |
* with the given label. |
|
Lines 1366-1372
Link Here
|
| 1366 |
* @param labelText The text to label the main composite |
1366 |
* @param labelText The text to label the main composite |
| 1367 |
* @param centerPane The main widget |
1367 |
* @param centerPane The main widget |
| 1368 |
* @param helpId The topic help ID to be registered for the given center |
1368 |
* @param helpId The topic help ID to be registered for the given center |
| 1369 |
* compositer |
1369 |
* composite |
| 1370 |
* @return The container of the label and the given center control |
1370 |
* @return The container of the label and the given center control |
| 1371 |
* |
1371 |
* |
| 1372 |
* @category Layout |
1372 |
* @category Layout |
|
Lines 1418-1424
Link Here
|
| 1418 |
* @param centerControl The main widget |
1418 |
* @param centerControl The main widget |
| 1419 |
* @param rightControl The control shown to the right of the main widget |
1419 |
* @param rightControl The control shown to the right of the main widget |
| 1420 |
* @param helpId The topic help ID to be registered for the given center |
1420 |
* @param helpId The topic help ID to be registered for the given center |
| 1421 |
* compositer |
1421 |
* composite |
| 1422 |
* @return The container of the label and the given center control |
1422 |
* @return The container of the label and the given center control |
| 1423 |
* |
1423 |
* |
| 1424 |
* @category Layout |
1424 |
* @category Layout |
|
Lines 1446-1452
Link Here
|
| 1446 |
* @param labelText The text to label the main composite |
1446 |
* @param labelText The text to label the main composite |
| 1447 |
* @param centerControl The main widget |
1447 |
* @param centerControl The main widget |
| 1448 |
* @param helpId The topic help ID to be registered for the given center |
1448 |
* @param helpId The topic help ID to be registered for the given center |
| 1449 |
* compositer |
1449 |
* composite |
| 1450 |
* @return The container of the label and the given center control |
1450 |
* @return The container of the label and the given center control |
| 1451 |
* |
1451 |
* |
| 1452 |
* @category Layout |
1452 |
* @category Layout |
|
Lines 1475-1481
Link Here
|
| 1475 |
* @param centerControl The main widget |
1475 |
* @param centerControl The main widget |
| 1476 |
* @param rightControl The control shown to the right of the main widget |
1476 |
* @param rightControl The control shown to the right of the main widget |
| 1477 |
* @param helpId The topic help ID to be registered for the given center |
1477 |
* @param helpId The topic help ID to be registered for the given center |
| 1478 |
* compositer |
1478 |
* composite |
| 1479 |
* @return The newly created <code>CCombo</code> |
1479 |
* @return The newly created <code>CCombo</code> |
| 1480 |
* |
1480 |
* |
| 1481 |
* @category Layout |
1481 |
* @category Layout |
|
Lines 1509-1515
Link Here
|
| 1509 |
* @param comboListener The listener that will be notified when the selection |
1509 |
* @param comboListener The listener that will be notified when the selection |
| 1510 |
* changes |
1510 |
* changes |
| 1511 |
* @param helpId The topic help ID to be registered for the given center |
1511 |
* @param helpId The topic help ID to be registered for the given center |
| 1512 |
* compositer |
1512 |
* composite |
| 1513 |
* @return The newly created <code>CCombo</code> |
1513 |
* @return The newly created <code>CCombo</code> |
| 1514 |
* |
1514 |
* |
| 1515 |
* @category Layout |
1515 |
* @category Layout |
|
Lines 1539-1545
Link Here
|
| 1539 |
* into human readable strings |
1539 |
* into human readable strings |
| 1540 |
* @param rightControl The control shown to the right of the main widget |
1540 |
* @param rightControl The control shown to the right of the main widget |
| 1541 |
* @param helpId The topic help ID to be registered for the given center |
1541 |
* @param helpId The topic help ID to be registered for the given center |
| 1542 |
* compositer |
1542 |
* composite |
| 1543 |
* @return The newly created <code>CCombo</code> |
1543 |
* @return The newly created <code>CCombo</code> |
| 1544 |
* |
1544 |
* |
| 1545 |
* @category Layout |
1545 |
* @category Layout |
|
Lines 1581-1587
Link Here
|
| 1581 |
* @param labelProvider The provider responsible to convert the combo's items |
1581 |
* @param labelProvider The provider responsible to convert the combo's items |
| 1582 |
* into human readable strings |
1582 |
* into human readable strings |
| 1583 |
* @param helpId The topic help ID to be registered for the given center |
1583 |
* @param helpId The topic help ID to be registered for the given center |
| 1584 |
* compositer |
1584 |
* composite |
| 1585 |
* @return The newly created <code>CCombo</code> |
1585 |
* @return The newly created <code>CCombo</code> |
| 1586 |
* |
1586 |
* |
| 1587 |
* @category Layout |
1587 |
* @category Layout |
|
Lines 1601-1607
Link Here
|
| 1601 |
helpId |
1601 |
helpId |
| 1602 |
); |
1602 |
); |
| 1603 |
} |
1603 |
} |
| 1604 |
|
1604 |
|
| 1605 |
/** |
1605 |
/** |
| 1606 |
* Creates a new container that will have an editable combo labeled with the |
1606 |
* Creates a new container that will have an editable combo labeled with the |
| 1607 |
* given text. |
1607 |
* given text. |
|
Lines 1645-1651
Link Here
|
| 1645 |
* into a string representation |
1645 |
* into a string representation |
| 1646 |
* @param rightControl The control shown to the right of the main widget |
1646 |
* @param rightControl The control shown to the right of the main widget |
| 1647 |
* @param helpId The topic help ID to be registered for the given center |
1647 |
* @param helpId The topic help ID to be registered for the given center |
| 1648 |
* compositer |
1648 |
* composite |
| 1649 |
* @return The newly created <code>Combo</code> |
1649 |
* @return The newly created <code>Combo</code> |
| 1650 |
* |
1650 |
* |
| 1651 |
* @category Layout |
1651 |
* @category Layout |
|
Lines 1687-1693
Link Here
|
| 1687 |
* @param stringConverter The converter responsible to transform each item |
1687 |
* @param stringConverter The converter responsible to transform each item |
| 1688 |
* into a string representation |
1688 |
* into a string representation |
| 1689 |
* @param helpId The topic help ID to be registered for the given center |
1689 |
* @param helpId The topic help ID to be registered for the given center |
| 1690 |
* compositer |
1690 |
* composite |
| 1691 |
* @return The newly created <code>Combo</code> |
1691 |
* @return The newly created <code>Combo</code> |
| 1692 |
* |
1692 |
* |
| 1693 |
* @category Layout |
1693 |
* @category Layout |
|
Lines 1884-1890
Link Here
|
| 1884 |
|
1884 |
|
| 1885 |
/** |
1885 |
/** |
| 1886 |
* Creates a new managed spinner. Managed means that this Pane will |
1886 |
* Creates a new managed spinner. Managed means that this Pane will |
| 1887 |
* handle enabling/disabling of this widget if a PaneEnabler is used. |
1887 |
* handle enabling/disabling of this widget if a PaneEnabler is used. |
| 1888 |
* |
1888 |
* |
| 1889 |
* @param parent The parent container |
1889 |
* @param parent The parent container |
| 1890 |
* @param numberHolder The holder of the integer value |
1890 |
* @param numberHolder The holder of the integer value |
|
Lines 1945-1954
Link Here
|
| 1945 |
|
1945 |
|
| 1946 |
return spinner; |
1946 |
return spinner; |
| 1947 |
} |
1947 |
} |
| 1948 |
|
1948 |
|
| 1949 |
/** |
1949 |
/** |
| 1950 |
* Creates a new managed DateTime of type SWT.TIME. Managed means that this Pane will |
1950 |
* Creates a new managed DateTime of type SWT.TIME. Managed means that this Pane will |
| 1951 |
* handle enabling/disabling of this widget if a PaneEnabler is used. |
1951 |
* handle enabling/disabling of this widget if a PaneEnabler is used. |
| 1952 |
* |
1952 |
* |
| 1953 |
* @param parent The parent container |
1953 |
* @param parent The parent container |
| 1954 |
* @param hoursHolder The holder of the hours integer value |
1954 |
* @param hoursHolder The holder of the hours integer value |
|
Lines 1964-1970
Link Here
|
| 1964 |
WritablePropertyValueModel<Integer> minutesHolder, |
1964 |
WritablePropertyValueModel<Integer> minutesHolder, |
| 1965 |
WritablePropertyValueModel<Integer> secondsHolder, |
1965 |
WritablePropertyValueModel<Integer> secondsHolder, |
| 1966 |
String helpId) { |
1966 |
String helpId) { |
| 1967 |
|
1967 |
|
| 1968 |
DateTime dateTime = this.addUnmanagedDateTime(parent, hoursHolder, minutesHolder, secondsHolder, helpId); |
1968 |
DateTime dateTime = this.addUnmanagedDateTime(parent, hoursHolder, minutesHolder, secondsHolder, helpId); |
| 1969 |
this.manageWidget(dateTime); |
1969 |
this.manageWidget(dateTime); |
| 1970 |
|
1970 |
|
|
Lines 2003-2013
Link Here
|
| 2003 |
WritablePropertyValueModel<Integer> minutesHolder, |
2003 |
WritablePropertyValueModel<Integer> minutesHolder, |
| 2004 |
WritablePropertyValueModel<Integer> secondsHolder, |
2004 |
WritablePropertyValueModel<Integer> secondsHolder, |
| 2005 |
String helpId) { |
2005 |
String helpId) { |
| 2006 |
|
2006 |
|
| 2007 |
DateTime dateTime = this.widgetFactory.createDateTime(parent, SWT.TIME); |
2007 |
DateTime dateTime = this.widgetFactory.createDateTime(parent, SWT.TIME); |
| 2008 |
|
2008 |
|
| 2009 |
DateTimeModelAdapter.adapt(hoursHolder, minutesHolder, secondsHolder, dateTime); |
2009 |
DateTimeModelAdapter.adapt(hoursHolder, minutesHolder, secondsHolder, dateTime); |
| 2010 |
|
2010 |
|
| 2011 |
if (helpId != null) { |
2011 |
if (helpId != null) { |
| 2012 |
getHelpSystem().setHelp(dateTime, helpId); |
2012 |
getHelpSystem().setHelp(dateTime, helpId); |
| 2013 |
} |
2013 |
} |
|
Lines 2043-2049
Link Here
|
| 2043 |
return combo; |
2043 |
return combo; |
| 2044 |
} |
2044 |
} |
| 2045 |
|
2045 |
|
| 2046 |
|
2046 |
|
| 2047 |
/** |
2047 |
/** |
| 2048 |
* Creates a new editable <code>Combo</code>. |
2048 |
* Creates a new editable <code>Combo</code>. |
| 2049 |
* |
2049 |
* |
|
Lines 2109-2115
Link Here
|
| 2109 |
return text; |
2109 |
return text; |
| 2110 |
} |
2110 |
} |
| 2111 |
/** |
2111 |
/** |
| 2112 |
* |
2112 |
* |
| 2113 |
* Creates a new container that will have a text field as the center control |
2113 |
* Creates a new container that will have a text field as the center control |
| 2114 |
* labeled with the given label. |
2114 |
* labeled with the given label. |
| 2115 |
* |
2115 |
* |
|
Lines 2233-2244
Link Here
|
| 2233 |
|
2233 |
|
| 2234 |
return list; |
2234 |
return list; |
| 2235 |
} |
2235 |
} |
| 2236 |
|
2236 |
|
| 2237 |
/** |
2237 |
/** |
| 2238 |
* Creates a new unmanaged list and notify the given selection holder when the |
2238 |
* Creates a new unmanaged list and notify the given selection holder when the |
| 2239 |
* selection changes. If the selection count is different than one than the |
2239 |
* selection changes. If the selection count is different than one than the |
| 2240 |
* holder will receive <code>null</code>. |
2240 |
* holder will receive <code>null</code>. |
| 2241 |
* Unmanaged means that this Pane will not handle the enabling/disabling of this widget. |
2241 |
* Unmanaged means that this Pane will not handle the enabling/disabling of this widget. |
| 2242 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
2242 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
| 2243 |
* |
2243 |
* |
| 2244 |
* @param container The parent container |
2244 |
* @param container The parent container |
|
Lines 2298-2304
Link Here
|
| 2298 |
|
2298 |
|
| 2299 |
return text; |
2299 |
return text; |
| 2300 |
} |
2300 |
} |
| 2301 |
|
2301 |
|
| 2302 |
/** |
2302 |
/** |
| 2303 |
* Creates a new <code>Text</code> widget that has multiple lines. |
2303 |
* Creates a new <code>Text</code> widget that has multiple lines. |
| 2304 |
* |
2304 |
* |
|
Lines 2310-2323
Link Here
|
| 2310 |
* @category Layout |
2310 |
* @category Layout |
| 2311 |
*/ |
2311 |
*/ |
| 2312 |
protected final Text addMultiLineText(Composite container, |
2312 |
protected final Text addMultiLineText(Composite container, |
| 2313 |
int lineCount, |
2313 |
int lineCount, |
| 2314 |
String helpId) { |
2314 |
String helpId) { |
| 2315 |
|
2315 |
|
| 2316 |
Text text = this.addMultiLineText(container); |
2316 |
Text text = this.addMultiLineText(container); |
| 2317 |
|
2317 |
adjustMultiLineTextLayout(container, lineCount, text, text.getLineHeight()); |
| 2318 |
GridData gridData = getFieldGridData(); |
|
|
| 2319 |
gridData.heightHint = text.getLineHeight() * lineCount; |
| 2320 |
text.setLayoutData(gridData); |
| 2321 |
|
2318 |
|
| 2322 |
if (helpId != null) { |
2319 |
if (helpId != null) { |
| 2323 |
getHelpSystem().setHelp(text, helpId); |
2320 |
getHelpSystem().setHelp(text, helpId); |
|
Lines 2364-2369
Link Here
|
| 2364 |
} |
2361 |
} |
| 2365 |
|
2362 |
|
| 2366 |
/** |
2363 |
/** |
|
|
2364 |
* Adjusts the layout of the given container so that the text control has the correct amount of |
| 2365 |
* lines by default. |
| 2366 |
*/ |
| 2367 |
protected final void adjustMultiLineTextLayout(Composite container, |
| 2368 |
int lineCount, |
| 2369 |
Control text, |
| 2370 |
int lineHeight) { |
| 2371 |
|
| 2372 |
int textHeight = text.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; |
| 2373 |
|
| 2374 |
// Specify the number of lines the text area should display |
| 2375 |
GridData gridData = (GridData) text.getLayoutData(); |
| 2376 |
if (gridData == null) { |
| 2377 |
gridData = this.getFieldGridData(); |
| 2378 |
text.setLayoutData(gridData); |
| 2379 |
} |
| 2380 |
gridData.heightHint = lineHeight * lineCount; |
| 2381 |
|
| 2382 |
// Move the label to the top of its cell |
| 2383 |
Control label = container.getChildren()[0]; |
| 2384 |
int labelHeight = label.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; |
| 2385 |
|
| 2386 |
gridData = (GridData) label.getLayoutData(); |
| 2387 |
gridData.verticalAlignment = SWT.TOP; |
| 2388 |
gridData.verticalIndent += (Math.abs(textHeight - labelHeight) / 2); |
| 2389 |
} |
| 2390 |
/** |
| 2367 |
* Creates a new <code>PageBook</code> and set the proper layout and layout |
2391 |
* Creates a new <code>PageBook</code> and set the proper layout and layout |
| 2368 |
* data. |
2392 |
* data. |
| 2369 |
* |
2393 |
* |
|
Lines 2425-2431
Link Here
|
| 2425 |
|
2449 |
|
| 2426 |
return text; |
2450 |
return text; |
| 2427 |
} |
2451 |
} |
| 2428 |
|
2452 |
|
| 2429 |
/** |
2453 |
/** |
| 2430 |
* Creates a new <code>Text</code> widget. |
2454 |
* Creates a new <code>Text</code> widget. |
| 2431 |
* |
2455 |
* |
|
Lines 2608-2614
Link Here
|
| 2608 |
section.setText(sectionText); |
2632 |
section.setText(sectionText); |
| 2609 |
section.marginWidth = 0; |
2633 |
section.marginWidth = 0; |
| 2610 |
section.marginHeight = 0; |
2634 |
section.marginHeight = 0; |
| 2611 |
|
2635 |
|
| 2612 |
if (description != null) { |
2636 |
if (description != null) { |
| 2613 |
section.setDescription(description); |
2637 |
section.setDescription(description); |
| 2614 |
} |
2638 |
} |
|
Lines 2869-2875
Link Here
|
| 2869 |
helpId |
2893 |
helpId |
| 2870 |
); |
2894 |
); |
| 2871 |
} |
2895 |
} |
| 2872 |
|
2896 |
|
| 2873 |
/** |
2897 |
/** |
| 2874 |
* Creates a new unmanaged table. Unmanaged means that this Pane will |
2898 |
* Creates a new unmanaged table. Unmanaged means that this Pane will |
| 2875 |
* not handle the enabling/disabling of this widget. The owning object will handle |
2899 |
* not handle the enabling/disabling of this widget. The owning object will handle |
|
Lines 2904-2913
Link Here
|
| 2904 |
this.manageWidget(text); |
2928 |
this.manageWidget(text); |
| 2905 |
return text; |
2929 |
return text; |
| 2906 |
} |
2930 |
} |
| 2907 |
|
2931 |
|
| 2908 |
/** |
2932 |
/** |
| 2909 |
* Creates a new unmanaged <code>Text</code> widget. Unmanaged means |
2933 |
* Creates a new unmanaged <code>Text</code> widget. Unmanaged means |
| 2910 |
* that this Pane will not handle the enabling/disabling of this widget. |
2934 |
* that this Pane will not handle the enabling/disabling of this widget. |
| 2911 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
2935 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
| 2912 |
* |
2936 |
* |
| 2913 |
* @param container The parent container |
2937 |
* @param container The parent container |
|
Lines 2940-2949
Link Here
|
| 2940 |
|
2964 |
|
| 2941 |
return text; |
2965 |
return text; |
| 2942 |
} |
2966 |
} |
| 2943 |
|
2967 |
|
| 2944 |
/** |
2968 |
/** |
| 2945 |
* Creates a new unmanaged <code>Text</code> widget. Unmanaged means |
2969 |
* Creates a new unmanaged <code>Text</code> widget. Unmanaged means |
| 2946 |
* that this Pane will not handle the enabling/disabling of this widget. |
2970 |
* that this Pane will not handle the enabling/disabling of this widget. |
| 2947 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
2971 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
| 2948 |
* |
2972 |
* |
| 2949 |
* @param container The parent container |
2973 |
* @param container The parent container |
|
Lines 2959-2968
Link Here
|
| 2959 |
if (helpId != null) { |
2983 |
if (helpId != null) { |
| 2960 |
getHelpSystem().setHelp(text, helpId); |
2984 |
getHelpSystem().setHelp(text, helpId); |
| 2961 |
} |
2985 |
} |
| 2962 |
|
2986 |
|
| 2963 |
return text; |
2987 |
return text; |
| 2964 |
} |
2988 |
} |
| 2965 |
|
2989 |
|
| 2966 |
/** |
2990 |
/** |
| 2967 |
* Creates a new <code>Text</code> widget. |
2991 |
* Creates a new <code>Text</code> widget. |
| 2968 |
* |
2992 |
* |
|
Lines 2997-3003
Link Here
|
| 2997 |
|
3021 |
|
| 2998 |
return text; |
3022 |
return text; |
| 2999 |
} |
3023 |
} |
| 3000 |
|
3024 |
|
| 3001 |
protected final Text addText( |
3025 |
protected final Text addText( |
| 3002 |
Composite container, |
3026 |
Composite container, |
| 3003 |
WritablePropertyValueModel<String> textHolder, |
3027 |
WritablePropertyValueModel<String> textHolder, |
|
Lines 3010-3017
Link Here
|
| 3010 |
} |
3034 |
} |
| 3011 |
|
3035 |
|
| 3012 |
/** |
3036 |
/** |
| 3013 |
* Creates a new unmanaged <code>Text</code> widget. Unmanaged means |
3037 |
* Creates a new unmanaged <code>Text</code> widget. Unmanaged means |
| 3014 |
* that this Pane will not handle the enabling/disabling of this widget. |
3038 |
* that this Pane will not handle the enabling/disabling of this widget. |
| 3015 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
3039 |
* The owning object will handle it with its own PaneEnabler or ControlEnabler. |
| 3016 |
* |
3040 |
* |
| 3017 |
* @param container The parent container |
3041 |
* @param container The parent container |
|
Lines 3060-3066
Link Here
|
| 3060 |
|
3084 |
|
| 3061 |
return addTitledGroup(container, title, 1, helpId); |
3085 |
return addTitledGroup(container, title, 1, helpId); |
| 3062 |
} |
3086 |
} |
| 3063 |
|
3087 |
|
| 3064 |
/** |
3088 |
/** |
| 3065 |
* Creates a new container with a titled border. |
3089 |
* Creates a new container with a titled border. |
| 3066 |
* |
3090 |
* |
|
Lines 3077-3083
Link Here
|
| 3077 |
String helpId) { |
3101 |
String helpId) { |
| 3078 |
|
3102 |
|
| 3079 |
Group group = this.widgetFactory.createGroup(container, title); |
3103 |
Group group = this.widgetFactory.createGroup(container, title); |
| 3080 |
//manageWidget(group); TODO unsure if I want to manage groups, |
3104 |
//manageWidget(group); TODO unsure if I want to manage groups, |
| 3081 |
//also should probably rename this addUnmanagedTitledPane |
3105 |
//also should probably rename this addUnmanagedTitledPane |
| 3082 |
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
3106 |
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 3083 |
|
3107 |
|
|
Lines 3098-3106
Link Here
|
| 3098 |
} |
3122 |
} |
| 3099 |
|
3123 |
|
| 3100 |
/** |
3124 |
/** |
| 3101 |
* Creates a new unmanaged new toggle button (radio button or check box). |
3125 |
* Creates a new unmanaged new toggle button (radio button or check box). |
| 3102 |
* Unmanaged means that this Pane will not handle the enabling/disabling |
3126 |
* Unmanaged means that this Pane will not handle the enabling/disabling |
| 3103 |
* of this widget. The owning object will handle it with its own PaneEnabler |
3127 |
* of this widget. The owning object will handle it with its own PaneEnabler |
| 3104 |
* or ControlEnabler. |
3128 |
* or ControlEnabler. |
| 3105 |
* |
3129 |
* |
| 3106 |
* @param parent The parent container |
3130 |
* @param parent The parent container |
|
Lines 3117-3125
Link Here
|
| 3117 |
WritablePropertyValueModel<Boolean> booleanHolder, |
3141 |
WritablePropertyValueModel<Boolean> booleanHolder, |
| 3118 |
String helpId, |
3142 |
String helpId, |
| 3119 |
int toggleButtonType) { |
3143 |
int toggleButtonType) { |
| 3120 |
|
3144 |
|
| 3121 |
Button button; |
3145 |
Button button; |
| 3122 |
|
3146 |
|
| 3123 |
if (toggleButtonType == SWT.PUSH) { |
3147 |
if (toggleButtonType == SWT.PUSH) { |
| 3124 |
button = this.widgetFactory.createPushButton(parent, buttonText); |
3148 |
button = this.widgetFactory.createPushButton(parent, buttonText); |
| 3125 |
} |
3149 |
} |
|
Lines 3132-3148
Link Here
|
| 3132 |
else { |
3156 |
else { |
| 3133 |
button = this.widgetFactory.createButton(parent, buttonText); |
3157 |
button = this.widgetFactory.createButton(parent, buttonText); |
| 3134 |
} |
3158 |
} |
| 3135 |
|
3159 |
|
| 3136 |
button.setLayoutData(new GridData()); |
3160 |
button.setLayoutData(new GridData()); |
| 3137 |
SWTTools.bind(booleanHolder, button); |
3161 |
SWTTools.bind(booleanHolder, button); |
| 3138 |
|
3162 |
|
| 3139 |
if (helpId != null) { |
3163 |
if (helpId != null) { |
| 3140 |
getHelpSystem().setHelp(button, helpId); |
3164 |
getHelpSystem().setHelp(button, helpId); |
| 3141 |
} |
3165 |
} |
| 3142 |
|
3166 |
|
| 3143 |
return button; |
3167 |
return button; |
| 3144 |
} |
3168 |
} |
| 3145 |
|
3169 |
|
| 3146 |
/** |
3170 |
/** |
| 3147 |
* Creates a new toggle button (radio button or check box) using the given |
3171 |
* Creates a new toggle button (radio button or check box) using the given |
| 3148 |
* information. |
3172 |
* information. |
|
Lines 3161-3172
Link Here
|
| 3161 |
WritablePropertyValueModel<Boolean> booleanHolder, |
3185 |
WritablePropertyValueModel<Boolean> booleanHolder, |
| 3162 |
String helpId, |
3186 |
String helpId, |
| 3163 |
int toggleButtonType) { |
3187 |
int toggleButtonType) { |
| 3164 |
|
3188 |
|
| 3165 |
Button button = addUnmanagedToggleButton( |
3189 |
Button button = addUnmanagedToggleButton( |
| 3166 |
parent, |
3190 |
parent, |
| 3167 |
buttonText, |
3191 |
buttonText, |
| 3168 |
booleanHolder, |
3192 |
booleanHolder, |
| 3169 |
helpId, |
3193 |
helpId, |
| 3170 |
toggleButtonType); |
3194 |
toggleButtonType); |
| 3171 |
this.manageWidget(button); |
3195 |
this.manageWidget(button); |
| 3172 |
return button; |
3196 |
return button; |
|
Lines 3254-3260
Link Here
|
| 3254 |
protected void doPopulate() { |
3278 |
protected void doPopulate() { |
| 3255 |
this.log(Tracing.UI_LAYOUT, " ->doPopulate()"); |
3279 |
this.log(Tracing.UI_LAYOUT, " ->doPopulate()"); |
| 3256 |
} |
3280 |
} |
| 3257 |
|
3281 |
|
| 3258 |
private void controlEnabledState(PropertyValueModel<Boolean> booleanModel, Control... controls) { |
3282 |
private void controlEnabledState(PropertyValueModel<Boolean> booleanModel, Control... controls) { |
| 3259 |
this.controlEnabledState_(this.wrapEnabledModel(booleanModel), controls); |
3283 |
this.controlEnabledState_(this.wrapEnabledModel(booleanModel), controls); |
| 3260 |
} |
3284 |
} |
|
Lines 3266-3293
Link Here
|
| 3266 |
private PropertyValueModel<Boolean> wrapEnabledModel(PropertyValueModel<Boolean> booleanModel) { |
3290 |
private PropertyValueModel<Boolean> wrapEnabledModel(PropertyValueModel<Boolean> booleanModel) { |
| 3267 |
return new TransformationPropertyValueModel<Boolean, Boolean>(booleanModel, NonNullBooleanTransformer.FALSE); |
3291 |
return new TransformationPropertyValueModel<Boolean, Boolean>(booleanModel, NonNullBooleanTransformer.FALSE); |
| 3268 |
} |
3292 |
} |
| 3269 |
|
3293 |
|
| 3270 |
private void controlEnabledState_(PropertyValueModel<Boolean> booleanModel, Control... controls) { |
3294 |
private void controlEnabledState_(PropertyValueModel<Boolean> booleanModel, Control... controls) { |
| 3271 |
SWTTools.controlEnabledState(this.andEnabledModel(booleanModel), controls); |
3295 |
SWTTools.controlEnabledState(this.andEnabledModel(booleanModel), controls); |
| 3272 |
} |
3296 |
} |
| 3273 |
|
3297 |
|
| 3274 |
private PropertyValueModel<Boolean> getCombinedEnabledModel() { |
3298 |
private PropertyValueModel<Boolean> getCombinedEnabledModel() { |
| 3275 |
return (this.combinedEnabledModel != null) ? this.combinedEnabledModel : this.baseEnabledModel; |
3299 |
return (this.combinedEnabledModel != null) ? this.combinedEnabledModel : this.baseEnabledModel; |
| 3276 |
} |
3300 |
} |
| 3277 |
|
3301 |
|
| 3278 |
private boolean getCombinedEnablement() { |
3302 |
private boolean getCombinedEnablement() { |
| 3279 |
Boolean enabled = getCombinedEnabledModel().getValue(); |
3303 |
Boolean enabled = getCombinedEnabledModel().getValue(); |
| 3280 |
return (enabled == null) ? true : enabled.booleanValue(); |
3304 |
return (enabled == null) ? true : enabled.booleanValue(); |
| 3281 |
} |
3305 |
} |
| 3282 |
|
3306 |
|
| 3283 |
private PropertyValueModel<Boolean> andEnabledModel(PropertyValueModel<Boolean> booleanModel) { |
3307 |
private PropertyValueModel<Boolean> andEnabledModel(PropertyValueModel<Boolean> booleanModel) { |
| 3284 |
return CompositeBooleanPropertyValueModel.and(getCombinedEnabledModel(), booleanModel); |
3308 |
return CompositeBooleanPropertyValueModel.and(getCombinedEnabledModel(), booleanModel); |
| 3285 |
} |
3309 |
} |
| 3286 |
|
3310 |
|
| 3287 |
protected void controllerEnablementChanged() { |
3311 |
protected void controllerEnablementChanged() { |
| 3288 |
enableWidgets_(getCombinedEnablement()); |
3312 |
enableWidgets_(getCombinedEnablement()); |
| 3289 |
} |
3313 |
} |
| 3290 |
|
3314 |
|
| 3291 |
/** |
3315 |
/** |
| 3292 |
* Changes the enablement state of the widgets of this pane. |
3316 |
* Changes the enablement state of the widgets of this pane. |
| 3293 |
* |
3317 |
* |
|
Lines 3300-3322
Link Here
|
| 3300 |
this.baseEnabledModel.setValue(Boolean.valueOf(enabled)); |
3324 |
this.baseEnabledModel.setValue(Boolean.valueOf(enabled)); |
| 3301 |
enableWidgets_(getCombinedEnablement()); |
3325 |
enableWidgets_(getCombinedEnablement()); |
| 3302 |
} |
3326 |
} |
| 3303 |
|
3327 |
|
| 3304 |
private void enableWidgets_(boolean enabled) { |
3328 |
private void enableWidgets_(boolean enabled) { |
| 3305 |
if (! this.container.isDisposed()) { |
3329 |
if (! this.container.isDisposed()) { |
| 3306 |
for (Control control : this.managedWidgets) { |
3330 |
for (Control control : this.managedWidgets) { |
| 3307 |
control.setEnabled(enabled); |
3331 |
control.setEnabled(enabled); |
| 3308 |
} |
3332 |
} |
| 3309 |
|
3333 |
|
| 3310 |
for (Pane<?> subPane : this.managedSubPanes) { |
3334 |
for (Pane<?> subPane : this.managedSubPanes) { |
| 3311 |
subPane.enableWidgets(enabled); |
3335 |
subPane.enableWidgets(enabled); |
| 3312 |
} |
3336 |
} |
| 3313 |
} |
3337 |
} |
| 3314 |
} |
3338 |
} |
| 3315 |
|
3339 |
|
| 3316 |
private void engageSubjectHolder() { |
3340 |
private void engageSubjectHolder() { |
| 3317 |
this.subjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); |
3341 |
this.subjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); |
| 3318 |
} |
3342 |
} |
| 3319 |
|
3343 |
|
| 3320 |
/** |
3344 |
/** |
| 3321 |
* engage the specified subject |
3345 |
* engage the specified subject |
| 3322 |
*/ |
3346 |
*/ |
|
Lines 3698-3715
Link Here
|
| 3698 |
} |
3722 |
} |
| 3699 |
} |
3723 |
} |
| 3700 |
} |
3724 |
} |
| 3701 |
|
3725 |
|
| 3702 |
public void dispose() { |
3726 |
public void dispose() { |
| 3703 |
this.log(Tracing.UI_LAYOUT, "dispose()"); |
3727 |
this.log(Tracing.UI_LAYOUT, "dispose()"); |
| 3704 |
|
3728 |
|
| 3705 |
// Dispose this pane |
3729 |
// Dispose this pane |
| 3706 |
this.disengageListeners(getSubject()); |
3730 |
this.disengageListeners(getSubject()); |
| 3707 |
this.disengageSubjectHolder(); |
3731 |
this.disengageSubjectHolder(); |
| 3708 |
|
3732 |
|
| 3709 |
if (this.combinedEnabledModel != null && this.combinedEnabledModelListener != null) { |
3733 |
if (this.combinedEnabledModel != null && this.combinedEnabledModelListener != null) { |
| 3710 |
this.combinedEnabledModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.combinedEnabledModelListener); |
3734 |
this.combinedEnabledModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.combinedEnabledModelListener); |
| 3711 |
} |
3735 |
} |
| 3712 |
|
3736 |
|
| 3713 |
this.leftControlAligner.dispose(); |
3737 |
this.leftControlAligner.dispose(); |
| 3714 |
this.rightControlAligner.dispose(); |
3738 |
this.rightControlAligner.dispose(); |
| 3715 |
|
3739 |
|