1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.ui.client.configurable.mvc.sections; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.HashSet; |
20 | |
import java.util.List; |
21 | |
|
22 | |
import org.kuali.student.common.assembly.data.Data; |
23 | |
import org.kuali.student.common.assembly.data.QueryPath; |
24 | |
import org.kuali.student.common.assembly.data.Data.Key; |
25 | |
import org.kuali.student.common.ui.client.application.Application; |
26 | |
import org.kuali.student.common.ui.client.configurable.mvc.CanProcessValidationResults; |
27 | |
import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor; |
28 | |
import org.kuali.student.common.ui.client.configurable.mvc.LayoutController; |
29 | |
import org.kuali.student.common.ui.client.configurable.mvc.ValidationEventBinding; |
30 | |
import org.kuali.student.common.ui.client.configurable.mvc.ValidationEventBindingImpl; |
31 | |
import org.kuali.student.common.ui.client.configurable.mvc.binding.ModelWidgetBinding; |
32 | |
import org.kuali.student.common.ui.client.configurable.mvc.binding.ModelWidgetBindingSupport; |
33 | |
import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityComposite; |
34 | |
import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityGroup; |
35 | |
import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityGroupItem; |
36 | |
import org.kuali.student.common.ui.client.configurable.mvc.multiplicity.MultiplicityItem; |
37 | |
import org.kuali.student.common.ui.client.event.ContentDirtyEvent; |
38 | |
import org.kuali.student.common.ui.client.event.ValidateRequestEvent; |
39 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
40 | |
import org.kuali.student.common.ui.client.mvc.Controller; |
41 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
42 | |
import org.kuali.student.common.ui.client.mvc.HasCrossConstraints; |
43 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
44 | |
import org.kuali.student.common.ui.client.mvc.View; |
45 | |
import org.kuali.student.common.ui.client.validator.ValidatorClientUtils; |
46 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.AbbrPanel; |
47 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.FieldElement; |
48 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel; |
49 | |
import org.kuali.student.common.ui.client.widgets.field.layout.layouts.FieldLayout; |
50 | |
import org.kuali.student.common.validation.dto.ValidationResultInfo; |
51 | |
import org.kuali.student.common.validation.dto.ValidationResultInfo.ErrorLevel; |
52 | |
|
53 | |
import com.google.gwt.core.client.GWT; |
54 | |
import com.google.gwt.user.client.ui.Widget; |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | 0 | public abstract class BaseSection extends SpanPanel implements Section{ |
62 | |
|
63 | |
protected FieldLayout layout; |
64 | |
|
65 | 0 | protected ArrayList<Section> sections = new ArrayList<Section>(); |
66 | 0 | protected ArrayList<FieldDescriptor> fields = new ArrayList<FieldDescriptor>(); |
67 | 0 | protected LayoutController layoutController = null; |
68 | 0 | protected boolean isValidationEnabled = true; |
69 | 0 | protected boolean isDirty = false; |
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
@Override |
84 | |
public String addField(final FieldDescriptor fieldDescriptor) { |
85 | 0 | String key = null; |
86 | |
|
87 | 0 | if (fieldDescriptor.isVisible()){ |
88 | 0 | fields.add(fieldDescriptor); |
89 | 0 | key = layout.addField(fieldDescriptor.getFieldElement()); |
90 | |
|
91 | 0 | ValidationEventBinding binding = new ValidationEventBindingImpl(); |
92 | 0 | if(fieldDescriptor.getValidationRequestCallback()== null){ |
93 | 0 | fieldDescriptor.setValidationCallBack(new Callback<Boolean>() { |
94 | |
@Override |
95 | |
public void exec(Boolean result) { |
96 | 0 | final ModelWidgetBinding mwb = fieldDescriptor.getModelWidgetBinding(); |
97 | 0 | if (mwb != null) { |
98 | 0 | final Widget w = fieldDescriptor.getFieldWidget(); |
99 | 0 | final String modelId = fieldDescriptor.getModelId(); |
100 | |
final Controller parent; |
101 | 0 | Controller findResult = LayoutController.findParentLayout(w); |
102 | 0 | if(BaseSection.this instanceof View){ |
103 | 0 | findResult = ((View)BaseSection.this).getController(); |
104 | |
} |
105 | 0 | parent = findResult; |
106 | 0 | if(parent != null){ |
107 | 0 | if (modelId == null) { |
108 | 0 | parent.requestModel(new ModelRequestCallback<DataModel>() { |
109 | |
|
110 | |
@Override |
111 | |
public void onModelReady(DataModel model) { |
112 | 0 | validateField(fieldDescriptor, model, parent); |
113 | |
|
114 | |
|
115 | 0 | HashSet<HasCrossConstraints> fds = Application.getApplicationContext().getCrossConstraint(null, Application.getApplicationContext().getParentPath()+fieldDescriptor.getFieldKey()); |
116 | 0 | if(fds!=null){ |
117 | 0 | for(HasCrossConstraints fd:fds){ |
118 | 0 | fd.reprocessWithUpdatedConstraints(); |
119 | |
} |
120 | |
} |
121 | 0 | } |
122 | |
|
123 | |
@Override |
124 | |
public void onRequestFail(Throwable cause) { |
125 | 0 | GWT.log("Unable to retrieve model to validate " + fieldDescriptor.getFieldKey(), null); |
126 | 0 | } |
127 | |
|
128 | |
}); |
129 | |
} else { |
130 | 0 | parent.requestModel(modelId, new ModelRequestCallback<DataModel>() { |
131 | |
|
132 | |
@Override |
133 | |
public void onModelReady(DataModel model) { |
134 | 0 | validateField(fieldDescriptor, model, parent); |
135 | 0 | } |
136 | |
|
137 | |
@Override |
138 | |
public void onRequestFail(Throwable cause) { |
139 | 0 | GWT.log("Unable to retrieve model to validate " + fieldDescriptor.getFieldKey(), null); |
140 | 0 | } |
141 | |
|
142 | |
}); } |
143 | |
} |
144 | 0 | } else { |
145 | 0 | GWT.log(fieldDescriptor.getFieldKey() + " has no widget binding.", null); |
146 | |
} |
147 | 0 | } |
148 | |
}); |
149 | |
} |
150 | 0 | binding.bind(fieldDescriptor); |
151 | |
} |
152 | |
|
153 | 0 | return key; |
154 | |
} |
155 | |
|
156 | |
private void validateField( |
157 | |
final FieldDescriptor fieldDescriptor, final DataModel model, Controller controller) { |
158 | 0 | Widget w = fieldDescriptor.getFieldWidget(); |
159 | 0 | ModelWidgetBinding mwb = fieldDescriptor.getModelWidgetBinding(); |
160 | 0 | if(fieldDescriptor.getFieldKey() != null){ |
161 | 0 | mwb.setModelValue(w, model, fieldDescriptor.getFieldKey()); |
162 | 0 | dirtyCheckField(fieldDescriptor, model); |
163 | 0 | ValidateRequestEvent e = new ValidateRequestEvent(); |
164 | 0 | e.setFieldDescriptor(fieldDescriptor); |
165 | 0 | e.setValidateSingleField(true); |
166 | 0 | controller.fireApplicationEvent(e); |
167 | |
} |
168 | 0 | } |
169 | |
|
170 | |
private void dirtyCheckField(FieldDescriptor fieldDescriptor, DataModel model){ |
171 | 0 | QueryPath fieldPath = QueryPath.parse(fieldDescriptor.getFieldKey()); |
172 | 0 | QueryPath qPathDirty = fieldPath.subPath(0, fieldPath.size() - 1); |
173 | 0 | qPathDirty.add(ModelWidgetBindingSupport.RUNTIME_ROOT); |
174 | 0 | qPathDirty.add(ModelWidgetBindingSupport.DIRTY_PATH); |
175 | 0 | qPathDirty.add(fieldPath.get(fieldPath.size()-1)); |
176 | 0 | Boolean dirty = false; |
177 | |
|
178 | 0 | if(ensureDirtyFlagPath(model.getRoot(), qPathDirty)){ |
179 | 0 | dirty = model.get(qPathDirty); |
180 | |
} |
181 | 0 | if(dirty){ |
182 | 0 | setIsDirty(true); |
183 | 0 | fieldDescriptor.setDirty(true); |
184 | |
} |
185 | 0 | } |
186 | |
|
187 | |
protected boolean ensureDirtyFlagPath(Data root, QueryPath path) { |
188 | 0 | Data current = root; |
189 | 0 | boolean containsFlag = false; |
190 | 0 | for (int i = 0; i < path.size(); i++) { |
191 | 0 | Key key = path.get(i); |
192 | 0 | if(i == path.size() - 1){ |
193 | 0 | containsFlag = current.containsKey(key); |
194 | 0 | break; |
195 | |
} |
196 | 0 | Data d = current.get(key); |
197 | 0 | if (d == null) { |
198 | 0 | containsFlag = false; |
199 | 0 | break; |
200 | |
} |
201 | 0 | current = d; |
202 | |
} |
203 | 0 | return containsFlag; |
204 | |
} |
205 | |
|
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
|
211 | |
@Override |
212 | |
public String addSection(Section section) { |
213 | |
|
214 | 0 | section.setLayoutController(layoutController); |
215 | 0 | sections.add(section); |
216 | 0 | String key = layout.addLayout(section.getLayout()); |
217 | 0 | return key; |
218 | |
} |
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
|
224 | |
|
225 | |
@Override |
226 | |
public void removeSection(Section section){ |
227 | 0 | sections.remove(section); |
228 | 0 | layout.removeLayoutElement(section.getLayout()); |
229 | 0 | } |
230 | |
|
231 | |
|
232 | |
|
233 | |
|
234 | |
|
235 | |
protected void clearValidationErrors() { |
236 | 0 | layout.clearValidationErrors(); |
237 | 0 | } |
238 | |
|
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
public void clearValidationWarnings() { |
244 | 0 | layout.clearValidationWarnings(); |
245 | 0 | } |
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
@Override |
253 | |
public List<FieldDescriptor> getFields() { |
254 | 0 | List<FieldDescriptor> allFields = new ArrayList<FieldDescriptor>(); |
255 | 0 | allFields.addAll(fields); |
256 | |
|
257 | 0 | for(Section ns: sections){ |
258 | 0 | allFields.addAll(ns.getFields()); |
259 | |
} |
260 | 0 | return allFields; |
261 | |
} |
262 | |
|
263 | |
|
264 | |
|
265 | |
|
266 | |
|
267 | |
@Override |
268 | |
public List<FieldDescriptor> getUnnestedFields() { |
269 | 0 | return fields; |
270 | |
} |
271 | |
|
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
@Override |
277 | |
public List<Section> getSections() { |
278 | 0 | return sections; |
279 | |
} |
280 | |
|
281 | |
|
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
@Override |
288 | |
public ErrorLevel processValidationResults(List<ValidationResultInfo> results, boolean clearErrors){ |
289 | 0 | if(clearErrors){ |
290 | 0 | this.clearValidationErrors(); |
291 | |
} |
292 | 0 | ErrorLevel status = ErrorLevel.OK; |
293 | |
|
294 | 0 | if (isValidationEnabled){ |
295 | |
|
296 | 0 | for(FieldDescriptor f: this.fields){ |
297 | |
|
298 | 0 | if(f.hasHadFocus()){ |
299 | 0 | for(ValidationResultInfo vr: results){ |
300 | 0 | String vrElement = vr.getElement(); |
301 | 0 | if(vrElement.startsWith("/")){ |
302 | 0 | vrElement = vrElement.substring(1); |
303 | |
} |
304 | |
|
305 | 0 | vrElement = vrElement.replaceFirst("^(\\S+)/[0-9]+$", "$1"); |
306 | |
|
307 | 0 | if(vrElement.equals(f.getFieldKey())){ |
308 | 0 | FieldElement element = f.getFieldElement(); |
309 | 0 | if (element != null){ |
310 | 0 | ErrorLevel fieldStatus = element.processValidationResult(vr); |
311 | 0 | if(fieldStatus.getLevel() > status.getLevel()){ |
312 | 0 | status = fieldStatus; |
313 | |
} |
314 | |
} |
315 | |
} |
316 | 0 | } |
317 | |
} |
318 | |
|
319 | 0 | if(f.getFieldWidget() instanceof MultiplicityComposite ){ |
320 | 0 | MultiplicityComposite mc = (MultiplicityComposite) f.getFieldWidget(); |
321 | |
|
322 | |
|
323 | 0 | for(MultiplicityItem item: mc.getItems()){ |
324 | 0 | if(item.getItemWidget() instanceof Section && !item.isDeleted()){ |
325 | 0 | ErrorLevel fieldStatus = ((Section)item.getItemWidget()).processValidationResults(results, clearErrors); |
326 | 0 | if(fieldStatus.getLevel() > status.getLevel()){ |
327 | 0 | status = fieldStatus; |
328 | |
} |
329 | 0 | } |
330 | |
} |
331 | |
} |
332 | |
|
333 | 0 | if(f.getFieldWidget() instanceof MultiplicityGroup ){ |
334 | 0 | MultiplicityGroup mg = (MultiplicityGroup) f.getFieldWidget(); |
335 | |
|
336 | |
|
337 | 0 | for(MultiplicityGroupItem item: mg.getItems()){ |
338 | 0 | if(item.getItemWidget() instanceof Section && !item.isDeleted()){ |
339 | 0 | ErrorLevel fieldStatus = ((Section)item.getItemWidget()).processValidationResults(results, clearErrors); |
340 | 0 | if(fieldStatus.getLevel() > status.getLevel()){ |
341 | 0 | status = fieldStatus; |
342 | |
} |
343 | 0 | } |
344 | |
} |
345 | |
} |
346 | 0 | if (f.getFieldWidget() instanceof CanProcessValidationResults) { |
347 | 0 | ErrorLevel fieldStatus = ((CanProcessValidationResults) f.getFieldWidget()).processValidationResults(f, results, clearErrors); |
348 | 0 | if (fieldStatus.getLevel() > status.getLevel()) { |
349 | 0 | status = fieldStatus; |
350 | |
} |
351 | 0 | } |
352 | |
} |
353 | |
|
354 | 0 | for(Section s: sections){ |
355 | 0 | ErrorLevel subsectionStatus = s.processValidationResults(results,clearErrors); |
356 | 0 | if(subsectionStatus.getLevel() > status.getLevel()){ |
357 | 0 | status = subsectionStatus; |
358 | |
} |
359 | 0 | } |
360 | |
} |
361 | |
|
362 | 0 | return status; |
363 | |
} |
364 | |
|
365 | |
|
366 | |
|
367 | |
|
368 | |
|
369 | |
@Override |
370 | |
public ErrorLevel processValidationResults(List<ValidationResultInfo> results) { |
371 | 0 | return processValidationResults(results, true); |
372 | |
} |
373 | |
|
374 | |
|
375 | |
|
376 | |
|
377 | |
|
378 | |
|
379 | |
@Override |
380 | |
public LayoutController getLayoutController() { |
381 | 0 | return this.layoutController; |
382 | |
} |
383 | |
|
384 | |
@Override |
385 | |
public void setLayoutController(LayoutController controller) { |
386 | 0 | this.layoutController = controller; |
387 | 0 | } |
388 | |
|
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
|
394 | |
@Override |
395 | |
public String addWidget(Widget w) { |
396 | 0 | return layout.addWidget(w); |
397 | |
} |
398 | |
|
399 | |
|
400 | |
|
401 | |
|
402 | |
|
403 | |
|
404 | |
|
405 | |
public void setFieldHasHadFocusFlags(boolean hadFocus) { |
406 | 0 | for(FieldDescriptor f: fields){ |
407 | 0 | f.setHasHadFocus(hadFocus); |
408 | 0 | if(f.getFieldWidget() instanceof MultiplicityComposite){ |
409 | 0 | MultiplicityComposite mc = (MultiplicityComposite) f.getFieldWidget(); |
410 | |
|
411 | 0 | for(MultiplicityItem item: mc.getItems()){ |
412 | 0 | if(item.getItemWidget() instanceof Section && !item.isDeleted()){ |
413 | 0 | ((Section) item.getItemWidget()).setFieldHasHadFocusFlags(hadFocus); |
414 | |
} |
415 | |
} |
416 | 0 | }else if(f.getFieldWidget() instanceof MultiplicityGroup){ |
417 | 0 | MultiplicityGroup mg = (MultiplicityGroup) f.getFieldWidget(); |
418 | |
|
419 | 0 | for(MultiplicityGroupItem item: mg.getItems()){ |
420 | 0 | if(item.getItemWidget() instanceof Section && !item.isDeleted()){ |
421 | 0 | ((Section) item.getItemWidget()).setFieldHasHadFocusFlags(hadFocus); |
422 | |
} |
423 | |
} |
424 | 0 | } |
425 | |
} |
426 | |
|
427 | 0 | for(Section s: sections){ |
428 | 0 | s.setFieldHasHadFocusFlags(hadFocus); |
429 | |
} |
430 | |
|
431 | 0 | } |
432 | |
|
433 | |
|
434 | |
|
435 | |
|
436 | |
|
437 | |
@Override |
438 | |
public void enableValidation(boolean enableValidation) { |
439 | 0 | this.isValidationEnabled = enableValidation; |
440 | 0 | } |
441 | |
|
442 | |
@Override |
443 | |
public boolean isValidationEnabled() { |
444 | 0 | return isValidationEnabled; |
445 | |
} |
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
@Override |
454 | |
public void updateModel(DataModel model){ |
455 | 0 | SectionBinding.INSTANCE.setModelValue(this, model, ""); |
456 | 0 | } |
457 | |
|
458 | |
|
459 | |
|
460 | |
|
461 | |
|
462 | |
|
463 | |
|
464 | |
|
465 | |
|
466 | |
@Override |
467 | |
public void updateWidgetData(DataModel model) { |
468 | 0 | SectionBinding.INSTANCE.setWidgetValue(this, model, ""); |
469 | 0 | } |
470 | |
|
471 | |
|
472 | |
|
473 | |
|
474 | |
|
475 | |
@Override |
476 | |
public void resetFieldInteractionFlags() { |
477 | 0 | this.isDirty = false; |
478 | 0 | for(FieldDescriptor f: fields){ |
479 | 0 | f.setDirty(false); |
480 | 0 | f.setHasHadFocus(false); |
481 | |
} |
482 | |
|
483 | 0 | for(Section s: sections){ |
484 | 0 | s.resetFieldInteractionFlags(); |
485 | |
} |
486 | |
|
487 | 0 | } |
488 | |
|
489 | |
@Override |
490 | |
public void resetDirtyFlags() { |
491 | 0 | this.isDirty = false; |
492 | 0 | for(FieldDescriptor f: fields){ |
493 | 0 | f.setDirty(false); |
494 | |
} |
495 | |
|
496 | 0 | for(Section s: sections){ |
497 | 0 | s.resetDirtyFlags(); |
498 | |
} |
499 | 0 | } |
500 | |
|
501 | |
|
502 | |
|
503 | |
|
504 | |
|
505 | |
|
506 | |
|
507 | |
@Override |
508 | |
public String addSection(String key, Section section) { |
509 | 0 | sections.add(section); |
510 | 0 | section.getLayout().setKey(key); |
511 | 0 | String rkey = layout.addLayout(section.getLayout()); |
512 | 0 | return rkey; |
513 | |
} |
514 | |
|
515 | |
@Override |
516 | |
public FieldDescriptor getField(String fieldKey) { |
517 | 0 | for(FieldDescriptor f: fields){ |
518 | 0 | if(f.getFieldKey().equals(fieldKey)){ |
519 | 0 | return f; |
520 | |
} |
521 | |
} |
522 | 0 | return null; |
523 | |
} |
524 | |
|
525 | |
|
526 | |
|
527 | |
|
528 | |
|
529 | |
|
530 | |
|
531 | |
@Override |
532 | |
public FieldLayout getLayout() { |
533 | 0 | return layout; |
534 | |
} |
535 | |
|
536 | |
@Override |
537 | |
public Section getSection(String sectionKey) { |
538 | 0 | for(Section s: sections){ |
539 | 0 | if(s.getLayout().getKey().equals(sectionKey)){ |
540 | 0 | return s; |
541 | |
} |
542 | |
} |
543 | 0 | return null; |
544 | |
} |
545 | |
|
546 | |
@Override |
547 | |
public void removeField(String fieldKey) { |
548 | 0 | int index = 0; |
549 | 0 | boolean found = false; |
550 | 0 | for(FieldDescriptor f: fields){ |
551 | 0 | if(f.getFieldKey().equals(fieldKey)){ |
552 | 0 | index = fields.indexOf(f); |
553 | 0 | found = true; |
554 | 0 | break; |
555 | |
} |
556 | |
} |
557 | 0 | if(found){ |
558 | 0 | fields.remove(index); |
559 | |
} |
560 | 0 | layout.removeLayoutElement(fieldKey); |
561 | |
|
562 | 0 | } |
563 | |
|
564 | |
@Override |
565 | |
public void removeField(FieldDescriptor field) { |
566 | |
|
567 | 0 | fields.remove(field); |
568 | 0 | layout.removeLayoutElement(field.getFieldKey()); |
569 | |
|
570 | 0 | } |
571 | |
|
572 | |
@Override |
573 | |
public void removeSection(String sectionKey) { |
574 | 0 | int index = 0; |
575 | 0 | boolean found = false; |
576 | 0 | for(Section s: sections){ |
577 | 0 | if(s.getLayout().getKey().equals(sectionKey)){ |
578 | 0 | index = sections.indexOf(s); |
579 | 0 | found = true; |
580 | 0 | break; |
581 | |
} |
582 | |
} |
583 | 0 | if(found){ |
584 | 0 | sections.remove(index); |
585 | |
} |
586 | 0 | layout.removeLayoutElement(sectionKey); |
587 | |
|
588 | 0 | } |
589 | |
|
590 | |
@Override |
591 | |
public void removeWidget(Widget widget) { |
592 | 0 | layout.removeLayoutElement(widget); |
593 | |
|
594 | 0 | } |
595 | |
|
596 | |
@Override |
597 | |
public void removeWidget(String key) { |
598 | 0 | layout.removeLayoutElement(key); |
599 | |
|
600 | 0 | } |
601 | |
|
602 | |
|
603 | |
|
604 | |
|
605 | |
|
606 | |
|
607 | |
|
608 | |
public boolean isDirty(){ |
609 | 0 | if(!this.isDirty){ |
610 | |
|
611 | 0 | for(Section s: sections){ |
612 | 0 | if(s.isDirty()){ |
613 | 0 | setIsDirty(true); |
614 | 0 | break; |
615 | |
} |
616 | |
} |
617 | |
} |
618 | 0 | return isDirty; |
619 | |
} |
620 | |
|
621 | |
public void setIsDirty(boolean state) { |
622 | |
|
623 | 0 | if (layoutController == null){ |
624 | 0 | layoutController = LayoutController.findParentLayout(layout); |
625 | |
} |
626 | 0 | if (isDirty != state){ |
627 | 0 | isDirty = state; |
628 | 0 | if (layoutController != null && isDirty){ |
629 | 0 | layoutController.fireApplicationEvent(new ContentDirtyEvent()); |
630 | |
} |
631 | |
} |
632 | 0 | } |
633 | |
|
634 | |
|
635 | |
|
636 | |
|
637 | |
@Override |
638 | |
public void add(Widget w) { |
639 | 0 | super.add(w); |
640 | 0 | } |
641 | |
|
642 | |
|
643 | |
|
644 | |
|
645 | |
|
646 | |
@Override |
647 | |
public void addStyleName(String style) { |
648 | 0 | layout.addStyleName(style); |
649 | 0 | } |
650 | |
|
651 | |
@Override |
652 | |
public void setStyleName(String style) { |
653 | 0 | layout.setStyleName(style); |
654 | 0 | } |
655 | |
|
656 | |
|
657 | |
|
658 | |
|
659 | |
|
660 | |
public void setInstructions(String html){ |
661 | 0 | layout.setInstructions(html); |
662 | 0 | } |
663 | |
|
664 | |
|
665 | |
|
666 | |
|
667 | |
|
668 | |
public void setHelp(String html){ |
669 | 0 | layout.setHelp(html); |
670 | 0 | } |
671 | |
|
672 | |
|
673 | |
|
674 | |
|
675 | |
|
676 | |
public void setRequired(AbbrPanel required){ |
677 | 0 | layout.setRequired(required); |
678 | 0 | } |
679 | |
} |