75
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2007 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 ******************************************************************************/
|
|
13
|
|
14 module dwtx.ui.internal.forms.MessageManager;
|
|
15
|
|
16 import dwtx.ui.internal.forms.Messages;
|
|
17
|
|
18 import dwt.DWT;
|
|
19 import dwt.custom.CLabel;
|
|
20 import dwt.widgets.Composite;
|
|
21 import dwt.widgets.Control;
|
|
22 import dwt.widgets.Label;
|
|
23 import dwtx.jface.dialogs.IMessageProvider;
|
|
24 import dwtx.jface.fieldassist.ControlDecoration;
|
|
25 import dwtx.jface.fieldassist.FieldDecoration;
|
|
26 import dwtx.jface.fieldassist.FieldDecorationRegistry;
|
|
27 import dwtx.ui.forms.IMessage;
|
|
28 import dwtx.ui.forms.IMessageManager;
|
|
29 import dwtx.ui.forms.IMessagePrefixProvider;
|
|
30 import dwtx.ui.forms.widgets.Hyperlink;
|
|
31 import dwtx.ui.forms.widgets.ScrolledForm;
|
|
32
|
|
33 import dwt.dwthelper.utils;
|
|
34
|
|
35 import tango.util.collection.ArraySeq;
|
|
36 import tango.util.collection.HashMap;
|
|
37 import tango.util.Convert;
|
76
|
38 import tango.text.Text;
|
|
39 import tango.io.FileConst;
|
75
|
40 /**
|
|
41 * @see IMessageManager
|
|
42 */
|
|
43
|
|
44 public class MessageManager : IMessageManager {
|
|
45
|
76
|
46 private static DefaultPrefixProvider DEFAULT_PREFIX_PROVIDER_;
|
|
47 private static DefaultPrefixProvider DEFAULT_PREFIX_PROVIDER(){
|
75
|
48 if( DEFAULT_PREFIX_PROVIDER_ is null ){
|
|
49 synchronized(MessageManager.classinfo){
|
|
50 if( DEFAULT_PREFIX_PROVIDER_ is null ){
|
|
51 DEFAULT_PREFIX_PROVIDER_ = new DefaultPrefixProvider();
|
|
52 }
|
|
53 }
|
|
54 }
|
|
55 return DEFAULT_PREFIX_PROVIDER_;
|
|
56 }
|
|
57 private ArraySeq!(Object) messages;
|
|
58 private HashMap!(Object,Object) decorators;
|
|
59 private bool autoUpdate = true;
|
|
60 private ScrolledForm scrolledForm;
|
|
61 private IMessagePrefixProvider prefixProvider;
|
|
62 private int decorationPosition = DWT.LEFT | DWT.BOTTOM;
|
|
63
|
|
64 private static FieldDecoration standardError_;
|
|
65 private static FieldDecoration standardError(){
|
|
66 if( standardError_ is null ){
|
|
67 synchronized(MessageManager.classinfo){
|
|
68 if( standardError_ is null ){
|
|
69 standardError_ = FieldDecorationRegistry
|
|
70 .getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
|
|
71 }
|
|
72 }
|
|
73 }
|
|
74 return standardError_;
|
|
75 }
|
|
76
|
|
77 private static FieldDecoration standardWarning_;
|
|
78 private static FieldDecoration standardWarning(){
|
|
79 if( standardWarning_ is null ){
|
|
80 synchronized(MessageManager.classinfo){
|
|
81 if( standardWarning_ is null ){
|
|
82 standardWarning_ = FieldDecorationRegistry
|
|
83 .getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING);
|
|
84 }
|
|
85 }
|
|
86 }
|
|
87 return standardWarning_;
|
|
88 }
|
|
89
|
|
90 private static FieldDecoration standardInformation_;
|
|
91 private static FieldDecoration standardInformation(){
|
|
92 if( standardInformation_ is null ){
|
|
93 synchronized(MessageManager.classinfo){
|
|
94 if( standardInformation_ is null ){
|
|
95 standardInformation_ = FieldDecorationRegistry
|
|
96 .getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
|
|
97 }
|
|
98 }
|
|
99 }
|
|
100 return standardInformation_;
|
|
101 }
|
|
102
|
76
|
103 private static String[] SINGLE_MESSAGE_SUMMARY_KEYS;
|
|
104 private static String[] MULTIPLE_MESSAGE_SUMMARY_KEYS;
|
|
105
|
|
106 static this(){
|
|
107 SINGLE_MESSAGE_SUMMARY_KEYS = [
|
75
|
108 Messages.MessageManager_sMessageSummary,
|
|
109 Messages.MessageManager_sMessageSummary,
|
|
110 Messages.MessageManager_sWarningSummary,
|
|
111 Messages.MessageManager_sErrorSummary ];
|
|
112
|
76
|
113 MULTIPLE_MESSAGE_SUMMARY_KEYS = [
|
75
|
114 Messages.MessageManager_pMessageSummary,
|
|
115 Messages.MessageManager_pMessageSummary,
|
|
116 Messages.MessageManager_pWarningSummary,
|
|
117 Messages.MessageManager_pErrorSummary ];
|
76
|
118 }
|
75
|
119
|
|
120 static class Message : IMessage {
|
|
121 Control control;
|
|
122 Object data;
|
|
123 Object key;
|
|
124 String message;
|
|
125 int type;
|
|
126 String prefix;
|
|
127
|
|
128 this(Object key, String message, int type, Object data) {
|
|
129 this.key = key;
|
|
130 this.message = message;
|
|
131 this.type = type;
|
|
132 this.data = data;
|
|
133 }
|
|
134
|
|
135 /*
|
|
136 * (non-Javadoc)
|
|
137 *
|
|
138 * @see dwtx.jface.dialogs.IMessage#getKey()
|
|
139 */
|
|
140 public Object getKey() {
|
|
141 return key;
|
|
142 }
|
|
143
|
|
144 /*
|
|
145 * (non-Javadoc)
|
|
146 *
|
|
147 * @see dwtx.jface.dialogs.IMessageProvider#getMessage()
|
|
148 */
|
|
149 public String getMessage() {
|
|
150 return message;
|
|
151 }
|
|
152
|
|
153 /*
|
|
154 * (non-Javadoc)
|
|
155 *
|
|
156 * @see dwtx.jface.dialogs.IMessageProvider#getMessageType()
|
|
157 */
|
|
158 public int getMessageType() {
|
|
159 return type;
|
|
160 }
|
|
161
|
|
162 /*
|
|
163 * (non-Javadoc)
|
|
164 *
|
|
165 * @see dwtx.ui.forms.messages.IMessage#getControl()
|
|
166 */
|
|
167 public Control getControl() {
|
|
168 return control;
|
|
169 }
|
|
170
|
|
171 /*
|
|
172 * (non-Javadoc)
|
|
173 *
|
|
174 * @see dwtx.ui.forms.messages.IMessage#getData()
|
|
175 */
|
|
176 public Object getData() {
|
|
177 return data;
|
|
178 }
|
|
179
|
|
180 /*
|
|
181 * (non-Javadoc)
|
|
182 *
|
|
183 * @see dwtx.ui.forms.messages.IMessage#getPrefix()
|
|
184 */
|
|
185 public String getPrefix() {
|
|
186 return prefix;
|
|
187 }
|
|
188 }
|
|
189
|
|
190 static class DefaultPrefixProvider : IMessagePrefixProvider {
|
|
191
|
|
192 public String getPrefix(Control c) {
|
|
193 Composite parent = c.getParent();
|
|
194 Control[] siblings = parent.getChildren();
|
|
195 for (int i = 0; i < siblings.length; i++) {
|
|
196 if (siblings[i] is c) {
|
|
197 // this is us - go backward until you hit
|
|
198 // a label-like widget
|
|
199 for (int j = i - 1; j >= 0; j--) {
|
|
200 Control label = siblings[j];
|
|
201 String ltext = null;
|
|
202 if ( auto l = cast(Label)label ) {
|
|
203 ltext = l.getText();
|
|
204 } else if ( auto hl = cast(Hyperlink)label ) {
|
|
205 ltext = hl.getText();
|
|
206 } else if ( auto cl = cast(CLabel)label ) {
|
|
207 ltext = cl.getText();
|
|
208 }
|
|
209 if (ltext !is null) {
|
|
210 if (!ltext.endsWith(":")) //$NON-NLS-1$
|
|
211 return ltext ~ ": "; //$NON-NLS-1$
|
|
212 return ltext ~ " "; //$NON-NLS-1$
|
|
213 }
|
|
214 }
|
|
215 break;
|
|
216 }
|
|
217 }
|
|
218 return null;
|
|
219 }
|
|
220 }
|
|
221
|
|
222 class ControlDecorator {
|
|
223 private ControlDecoration decoration;
|
76
|
224 private ArraySeq!(Object) controlMessages;
|
75
|
225 private String prefix;
|
|
226
|
|
227 this(Control control) {
|
76
|
228 controlMessages = new ArraySeq!(Object);
|
75
|
229 this.decoration = new ControlDecoration(control, decorationPosition, scrolledForm.getBody());
|
|
230 }
|
|
231
|
|
232 public bool isDisposed() {
|
|
233 return decoration.getControl() is null;
|
|
234 }
|
|
235
|
|
236 void updatePrefix() {
|
|
237 prefix = null;
|
|
238 }
|
|
239
|
|
240 void updatePosition() {
|
|
241 Control control = decoration.getControl();
|
|
242 decoration.dispose();
|
|
243 this.decoration = new ControlDecoration(control, decorationPosition, scrolledForm.getBody());
|
|
244 update();
|
|
245 }
|
|
246
|
|
247 String getPrefix() {
|
|
248 if (prefix is null)
|
|
249 createPrefix();
|
|
250 return prefix;
|
|
251 }
|
|
252
|
|
253 private void createPrefix() {
|
|
254 if (prefixProvider is null) {
|
|
255 prefix = ""; //$NON-NLS-1$
|
|
256 return;
|
|
257 }
|
|
258 prefix = prefixProvider.getPrefix(decoration.getControl());
|
|
259 if (prefix is null)
|
|
260 // make a prefix anyway
|
|
261 prefix = ""; //$NON-NLS-1$
|
|
262 }
|
|
263
|
|
264 void addAll(ArraySeq!(Object) target) {
|
76
|
265 foreach( o; controlMessages ){
|
|
266 target.append(o);
|
|
267 }
|
75
|
268 }
|
|
269
|
|
270 void addMessage(Object key, String text, Object data, int type) {
|
|
271 Message message = this.outer.addMessage(getPrefix(), key,
|
|
272 text, data, type, controlMessages);
|
|
273 message.control = decoration.getControl();
|
|
274 if (isAutoUpdate())
|
|
275 update();
|
|
276 }
|
|
277
|
|
278 bool removeMessage(Object key) {
|
|
279 Message message = findMessage(key, controlMessages);
|
|
280 if (message !is null) {
|
|
281 controlMessages.remove(message);
|
|
282 if (isAutoUpdate())
|
|
283 update();
|
|
284 }
|
|
285 return message !is null;
|
|
286 }
|
|
287
|
|
288 bool removeMessages() {
|
76
|
289 if (controlMessages.drained())
|
75
|
290 return false;
|
|
291 controlMessages.clear();
|
|
292 if (isAutoUpdate())
|
|
293 update();
|
|
294 return true;
|
|
295 }
|
|
296
|
|
297 public void update() {
|
76
|
298 if (controlMessages.drained()) {
|
75
|
299 decoration.setDescriptionText(null);
|
|
300 decoration.hide();
|
|
301 } else {
|
|
302 auto peers = createPeers(controlMessages);
|
|
303 int type = (cast(IMessage) peers.get(0)).getMessageType();
|
|
304 String description = createDetails(createPeers(peers), true);
|
|
305 if (type is IMessageProvider.ERROR)
|
|
306 decoration.setImage(standardError.getImage());
|
|
307 else if (type is IMessageProvider.WARNING)
|
|
308 decoration.setImage(standardWarning.getImage());
|
|
309 else if (type is IMessageProvider.INFORMATION)
|
|
310 decoration.setImage(standardInformation.getImage());
|
|
311 decoration.setDescriptionText(description);
|
|
312 decoration.show();
|
|
313 }
|
|
314 }
|
|
315 }
|
|
316
|
|
317 /**
|
|
318 * Creates a new instance of the message manager that will work with the
|
|
319 * provided form.
|
|
320 *
|
|
321 * @param scrolledForm
|
|
322 * the form to control
|
|
323 */
|
|
324 public this(ScrolledForm scrolledForm) {
|
|
325 prefixProvider = DEFAULT_PREFIX_PROVIDER;
|
|
326 messages = new ArraySeq!(Object);
|
|
327 decorators = new HashMap!(Object,Object);
|
|
328 this.scrolledForm = scrolledForm;
|
|
329 }
|
|
330
|
|
331 /*
|
|
332 * (non-Javadoc)
|
|
333 *
|
|
334 * @see dwtx.ui.forms.IMessageManager#addMessage(java.lang.Object,
|
|
335 * java.lang.String, int)
|
|
336 */
|
|
337 public void addMessage(Object key, String messageText, Object data, int type) {
|
|
338 addMessage(null, key, messageText, data, type, messages);
|
|
339 if (isAutoUpdate())
|
|
340 updateForm();
|
|
341 }
|
|
342
|
|
343 /*
|
|
344 * (non-Javadoc)
|
|
345 *
|
|
346 * @see dwtx.ui.forms.IMessageManager#addMessage(java.lang.Object,
|
|
347 * java.lang.String, int, dwt.widgets.Control)
|
|
348 */
|
|
349 public void addMessage(Object key, String messageText, Object data,
|
|
350 int type, Control control) {
|
|
351 ControlDecorator dec = cast(ControlDecorator) decorators.get(control);
|
|
352
|
|
353 if (dec is null) {
|
|
354 dec = new ControlDecorator(control);
|
76
|
355 decorators.add(control, dec);
|
75
|
356 }
|
|
357 dec.addMessage(key, messageText, data, type);
|
|
358 if (isAutoUpdate())
|
|
359 updateForm();
|
|
360 }
|
|
361
|
|
362 /*
|
|
363 * (non-Javadoc)
|
|
364 *
|
|
365 * @see dwtx.ui.forms.IMessageManager#removeMessage(java.lang.Object)
|
|
366 */
|
|
367 public void removeMessage(Object key) {
|
|
368 Message message = findMessage(key, messages);
|
|
369 if (message !is null) {
|
|
370 messages.remove(message);
|
|
371 if (isAutoUpdate())
|
|
372 updateForm();
|
|
373 }
|
|
374 }
|
|
375
|
|
376 /*
|
|
377 * (non-Javadoc)
|
|
378 *
|
|
379 * @see dwtx.ui.forms.IMessageManager#removeMessages()
|
|
380 */
|
|
381 public void removeMessages() {
|
76
|
382 if (!messages.drained()) {
|
75
|
383 messages.clear();
|
|
384 if (isAutoUpdate())
|
|
385 updateForm();
|
|
386 }
|
|
387 }
|
|
388
|
|
389 /*
|
|
390 * (non-Javadoc)
|
|
391 *
|
|
392 * @see dwtx.ui.forms.IMessageManager#removeMessage(java.lang.Object,
|
|
393 * dwt.widgets.Control)
|
|
394 */
|
|
395 public void removeMessage(Object key, Control control) {
|
|
396 ControlDecorator dec = cast(ControlDecorator) decorators.get(control);
|
|
397 if (dec is null)
|
|
398 return;
|
|
399 if (dec.removeMessage(key))
|
|
400 if (isAutoUpdate())
|
|
401 updateForm();
|
|
402 }
|
|
403
|
|
404 /*
|
|
405 * (non-Javadoc)
|
|
406 *
|
|
407 * @see dwtx.ui.forms.IMessageManager#removeMessages(dwt.widgets.Control)
|
|
408 */
|
|
409 public void removeMessages(Control control) {
|
|
410 ControlDecorator dec = cast(ControlDecorator) decorators.get(control);
|
|
411 if (dec !is null) {
|
|
412 if (dec.removeMessages()) {
|
|
413 if (isAutoUpdate())
|
|
414 updateForm();
|
|
415 }
|
|
416 }
|
|
417 }
|
|
418
|
|
419 /*
|
|
420 * (non-Javadoc)
|
|
421 *
|
|
422 * @see dwtx.ui.forms.IMessageManager#removeAllMessages()
|
|
423 */
|
|
424 public void removeAllMessages() {
|
|
425 bool needsUpdate = false;
|
76
|
426 foreach( v; decorators ){
|
|
427 ControlDecorator control = cast(ControlDecorator) v;
|
75
|
428 if (control.removeMessages())
|
|
429 needsUpdate = true;
|
|
430 }
|
76
|
431 if (!messages.drained()) {
|
75
|
432 messages.clear();
|
|
433 needsUpdate = true;
|
|
434 }
|
|
435 if (needsUpdate && isAutoUpdate())
|
|
436 updateForm();
|
|
437 }
|
|
438
|
|
439 /*
|
|
440 * Adds the message if it does not already exist in the provided list.
|
|
441 */
|
|
442
|
|
443 private Message addMessage(String prefix, Object key, String messageText,
|
|
444 Object data, int type, ArraySeq!(Object) list) {
|
|
445 Message message = findMessage(key, list);
|
|
446 if (message is null) {
|
|
447 message = new Message(key, messageText, type, data);
|
|
448 message.prefix = prefix;
|
76
|
449 list.append(message);
|
75
|
450 } else {
|
|
451 message.message = messageText;
|
|
452 message.type = type;
|
|
453 message.data = data;
|
|
454 }
|
|
455 return message;
|
|
456 }
|
|
457
|
|
458 /*
|
|
459 * Finds the message with the provided key in the provided list.
|
|
460 */
|
|
461
|
|
462 private Message findMessage(Object key, ArraySeq!(Object) list) {
|
|
463 for (int i = 0; i < list.size(); i++) {
|
|
464 Message message = cast(Message) list.get(i);
|
76
|
465 if (message.getKey().opEquals(key))
|
75
|
466 return message;
|
|
467 }
|
|
468 return null;
|
|
469 }
|
|
470
|
|
471 /*
|
|
472 * (non-Javadoc)
|
|
473 *
|
|
474 * @see dwtx.ui.forms.IMessageManager#update()
|
|
475 */
|
|
476 public void update() {
|
|
477 // Update decorations
|
76
|
478 foreach( v; decorators ){
|
|
479 ControlDecorator dec = cast(ControlDecorator) v;
|
75
|
480 dec.update();
|
|
481 }
|
|
482 // Update the form
|
|
483 updateForm();
|
|
484 }
|
|
485
|
|
486 /*
|
|
487 * Updates the container by rolling the messages up from the controls.
|
|
488 */
|
|
489
|
|
490 private void updateForm() {
|
76
|
491 ArraySeq!(Object) mergedList = new ArraySeq!(Object);
|
|
492 foreach( o; messages ){
|
|
493 mergedList.append(o);
|
|
494 }
|
|
495 foreach( v; decorators ){
|
|
496 ControlDecorator dec = cast(ControlDecorator) v;
|
75
|
497 dec.addAll(mergedList);
|
|
498 }
|
|
499 update(mergedList);
|
|
500 }
|
|
501
|
|
502 private void update(ArraySeq!(Object) mergedList) {
|
|
503 pruneControlDecorators();
|
76
|
504 if (scrolledForm.getForm().getHead().getBounds().height is 0 || mergedList.drained() || mergedList is null) {
|
75
|
505 scrolledForm.setMessage(null, IMessageProvider.NONE);
|
|
506 return;
|
|
507 }
|
|
508 auto peers = createPeers(mergedList);
|
|
509 int maxType = (cast(IMessage) peers.get(0)).getMessageType();
|
|
510 String messageText;
|
|
511 IMessage[] array = arraycast!(IMessage)( peers
|
|
512 .toArray());
|
|
513 if (peers.size() is 1 && (cast(Message) peers.get(0)).prefix is null) {
|
|
514 // a single message
|
|
515 IMessage message = cast(IMessage) peers.get(0);
|
|
516 messageText = message.getMessage();
|
|
517 scrolledForm.setMessage(messageText, maxType, array);
|
|
518 } else {
|
|
519 // show a summary message for the message
|
|
520 // and list of errors for the details
|
|
521 if (peers.size() > 1)
|
|
522 messageText = Messages.bind(
|
|
523 MULTIPLE_MESSAGE_SUMMARY_KEYS[maxType],
|
|
524 [ to!(String)(peers.size()) ]); //$NON-NLS-1$
|
|
525 else
|
|
526 messageText = SINGLE_MESSAGE_SUMMARY_KEYS[maxType];
|
|
527 scrolledForm.setMessage(messageText, maxType, array);
|
|
528 }
|
|
529 }
|
|
530
|
|
531 private static String getFullMessage(IMessage message) {
|
|
532 if (message.getPrefix() is null)
|
|
533 return message.getMessage();
|
76
|
534 return message.getPrefix() ~ message.getMessage();
|
75
|
535 }
|
|
536
|
76
|
537 private ArraySeq!(Object) createPeers(ArraySeq!(Object) messages) {
|
|
538 auto peers = new ArraySeq!(Object);
|
75
|
539 int maxType = 0;
|
76
|
540 foreach( o; messages ){
|
|
541 auto message = cast(Message)o;
|
75
|
542 if (message.type > maxType) {
|
|
543 peers.clear();
|
|
544 maxType = message.type;
|
|
545 }
|
|
546 if (message.type is maxType)
|
|
547 peers.append(message);
|
|
548 }
|
|
549 return peers;
|
|
550 }
|
|
551
|
|
552 private String createDetails(ArraySeq!(Object) messages, bool excludePrefix) {
|
76
|
553 auto txt = new tango.text.Text.Text!(char);
|
75
|
554
|
|
555 for (int i = 0; i < messages.size(); i++) {
|
|
556 if (i > 0)
|
76
|
557 txt.append( FileConst.NewlineString );
|
75
|
558 IMessage m = cast(IMessage) messages.get(i);
|
76
|
559 txt.append(excludePrefix ? m.getMessage() : getFullMessage(m));
|
75
|
560 }
|
76
|
561 return txt.toString();
|
75
|
562 }
|
|
563
|
|
564 public static String createDetails(IMessage[] messages) {
|
|
565 if (messages is null || messages.length is 0)
|
|
566 return null;
|
76
|
567 auto txt = new tango.text.Text.Text!(char);
|
75
|
568
|
|
569 for (int i = 0; i < messages.length; i++) {
|
|
570 if (i > 0)
|
76
|
571 txt.append( FileConst.NewlineString );
|
|
572 txt.append(getFullMessage(messages[i]));
|
75
|
573 }
|
76
|
574 return txt.toString();
|
75
|
575 }
|
|
576
|
|
577 /*
|
|
578 * (non-Javadoc)
|
|
579 *
|
|
580 * @see dwtx.ui.forms.IMessageManager#createSummary(dwtx.ui.forms.IMessage[])
|
|
581 */
|
|
582 public String createSummary(IMessage[] messages) {
|
|
583 return createDetails(messages);
|
|
584 }
|
|
585
|
|
586 private void pruneControlDecorators() {
|
76
|
587 foreach( o; decorators.dup ){
|
|
588 ControlDecorator dec = cast(ControlDecorator) o;
|
75
|
589 if (dec.isDisposed())
|
76
|
590 decorators.remove(o);
|
75
|
591 }
|
|
592 }
|
|
593
|
|
594 /*
|
|
595 * (non-Javadoc)
|
|
596 *
|
|
597 * @see dwtx.ui.forms.IMessageManager#getMessagePrefixProvider()
|
|
598 */
|
|
599 public IMessagePrefixProvider getMessagePrefixProvider() {
|
|
600 return prefixProvider;
|
|
601 }
|
|
602
|
|
603 /*
|
|
604 * (non-Javadoc)
|
|
605 *
|
|
606 * @see dwtx.ui.forms.IMessageManager#setMessagePrefixProvider(dwtx.ui.forms.IMessagePrefixProvider)
|
|
607 */
|
|
608 public void setMessagePrefixProvider(IMessagePrefixProvider provider) {
|
|
609 this.prefixProvider = provider;
|
76
|
610 foreach( o; decorators ){
|
|
611 ControlDecorator dec = cast(ControlDecorator) o;
|
75
|
612 dec.updatePrefix();
|
|
613 }
|
|
614 }
|
|
615
|
|
616 /*
|
|
617 * (non-Javadoc)
|
|
618 *
|
|
619 * @see dwtx.ui.forms.IMessageManager#getDecorationPosition()
|
|
620 */
|
|
621 public int getDecorationPosition() {
|
|
622 return decorationPosition;
|
|
623 }
|
|
624
|
|
625 /*
|
|
626 * (non-Javadoc)
|
|
627 *
|
|
628 * @see dwtx.ui.forms.IMessageManager#setDecorationPosition(int)
|
|
629 */
|
|
630 public void setDecorationPosition(int position) {
|
|
631 this.decorationPosition = position;
|
76
|
632 foreach( o; decorators ){
|
|
633 ControlDecorator dec = cast(ControlDecorator) o;
|
75
|
634 dec.updatePosition();
|
|
635 }
|
|
636 }
|
|
637
|
|
638 /*
|
|
639 * (non-Javadoc)
|
|
640 *
|
|
641 * @see dwtx.ui.forms.IMessageManager#isAutoUpdate()
|
|
642 */
|
|
643 public bool isAutoUpdate() {
|
|
644 return autoUpdate;
|
|
645 }
|
|
646
|
|
647 /*
|
|
648 * (non-Javadoc)
|
|
649 *
|
|
650 * @see dwtx.ui.forms.IMessageManager#setAutoUpdate(bool)
|
|
651 */
|
|
652 public void setAutoUpdate(bool autoUpdate) {
|
|
653 bool needsUpdate = !this.autoUpdate && autoUpdate;
|
|
654 this.autoUpdate = autoUpdate;
|
|
655 if (needsUpdate)
|
|
656 update();
|
|
657 }
|
|
658 }
|