Mercurial > projects > dwt-addons
comparison dwtx/jface/dialogs/ControlEnableState.d @ 104:04b47443bb01
Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 07 Aug 2008 15:01:33 +0200 |
parents | 7615869f89e6 |
children |
comparison
equal
deleted
inserted
replaced
103:2d6540440fe6 | 104:04b47443bb01 |
---|---|
10 * Port to the D programming language: | 10 * Port to the D programming language: |
11 * Frank Benoit <benoit@tionex.de> | 11 * Frank Benoit <benoit@tionex.de> |
12 *******************************************************************************/ | 12 *******************************************************************************/ |
13 module dwtx.jface.dialogs.ControlEnableState; | 13 module dwtx.jface.dialogs.ControlEnableState; |
14 | 14 |
15 import tango.util.collection.ArraySeq; | |
16 import tango.util.collection.model.Seq; | |
17 | 15 |
18 import dwt.widgets.Composite; | 16 import dwt.widgets.Composite; |
19 import dwt.widgets.Control; | 17 import dwt.widgets.Control; |
20 | 18 |
21 import dwt.dwthelper.utils; | 19 import dwt.dwthelper.utils; |
20 import dwtx.dwtxhelper.Collection; | |
22 | 21 |
23 /** | 22 /** |
24 * Helper class to save the enable/disable state of a control including all its | 23 * Helper class to save the enable/disable state of a control including all its |
25 * descendent controls. | 24 * descendent controls. |
26 */ | 25 */ |
27 public class ControlEnableState { | 26 public class ControlEnableState { |
28 /** | 27 /** |
29 * List of exception controls (element type: <code>Control</code>); | 28 * List of exception controls (element type: <code>Control</code>); |
30 * <code>null</code> if none. | 29 * <code>null</code> if none. |
31 */ | 30 */ |
32 private Seq!(Control) exceptions = null; | 31 private List exceptions = null; |
33 | 32 |
34 /** | 33 /** |
35 * List of saved states (element type: <code>ItemState</code>). | 34 * List of saved states (element type: <code>ItemState</code>). |
36 */ | 35 */ |
37 private Seq!(Object) states; | 36 private List states; |
38 | 37 |
39 /** | 38 /** |
40 * Internal class for recording the enable/disable state of a single | 39 * Internal class for recording the enable/disable state of a single |
41 * control. | 40 * control. |
42 */ | 41 */ |
91 * the control | 90 * the control |
92 * @param exceptions | 91 * @param exceptions |
93 * the list of controls to not disable (element type: | 92 * the list of controls to not disable (element type: |
94 * <code>Control</code>), or <code>null</code> if none | 93 * <code>Control</code>), or <code>null</code> if none |
95 */ | 94 */ |
96 protected this(Control w, Seq!(Control) exceptions) { | 95 protected this(Control w, List exceptions) { |
97 // super(); | 96 // super(); |
98 states = new ArraySeq!(Object); | 97 states = new ArrayList(); |
99 this.exceptions = exceptions; | 98 this.exceptions = exceptions; |
100 readStateForAndDisable(w); | 99 readStateForAndDisable(w); |
101 } | 100 } |
102 | 101 |
103 /** | 102 /** |
122 * @param exceptions | 121 * @param exceptions |
123 * the list of controls to not disable (element type: | 122 * the list of controls to not disable (element type: |
124 * <code>Control</code>) | 123 * <code>Control</code>) |
125 * @return an object capturing the enable/disable state | 124 * @return an object capturing the enable/disable state |
126 */ | 125 */ |
127 public static ControlEnableState disable(Control w, Seq!(Control) exceptions) { | 126 public static ControlEnableState disable(Control w, List exceptions) { |
128 return new ControlEnableState(w, exceptions); | 127 return new ControlEnableState(w, exceptions); |
129 } | 128 } |
130 | 129 |
131 /** | 130 /** |
132 * Recursively reads the enable/disable state for the given window and | 131 * Recursively reads the enable/disable state for the given window and |
143 readStateForAndDisable(children[i]); | 142 readStateForAndDisable(children[i]); |
144 } | 143 } |
145 } | 144 } |
146 // XXX: Workaround for 1G2Q8SS: ITPUI:Linux - Combo box is not enabled | 145 // XXX: Workaround for 1G2Q8SS: ITPUI:Linux - Combo box is not enabled |
147 // in "File->New->Solution" | 146 // in "File->New->Solution" |
148 states.append(new ItemState(control, control.getEnabled())); | 147 states.add(new ItemState(control, control.getEnabled())); |
149 control.setEnabled(false); | 148 control.setEnabled(false); |
150 } | 149 } |
151 | 150 |
152 /** | 151 /** |
153 * Restores the window enable state saved in this object. | 152 * Restores the window enable state saved in this object. |