|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| package org.apache.tapestry; |
|
16 |
| |
|
17 |
| import java.util.Collection; |
|
18 |
| import java.util.Collections; |
|
19 |
| import java.util.HashMap; |
|
20 |
| import java.util.HashSet; |
|
21 |
| import java.util.Iterator; |
|
22 |
| import java.util.List; |
|
23 |
| import java.util.Map; |
|
24 |
| |
|
25 |
| import org.apache.hivemind.ApplicationRuntimeException; |
|
26 |
| import org.apache.hivemind.Messages; |
|
27 |
| import org.apache.hivemind.impl.BaseLocatable; |
|
28 |
| import org.apache.hivemind.util.Defense; |
|
29 |
| import org.apache.hivemind.util.PropertyUtils; |
|
30 |
| import org.apache.tapestry.bean.BeanProvider; |
|
31 |
| import org.apache.tapestry.engine.IPageLoader; |
|
32 |
| import org.apache.tapestry.event.PageEvent; |
|
33 |
| import org.apache.tapestry.listener.ListenerMap; |
|
34 |
| import org.apache.tapestry.spec.IComponentSpecification; |
|
35 |
| import org.apache.tapestry.spec.IContainedComponent; |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| public abstract class AbstractComponent extends BaseLocatable implements IComponent |
|
44 |
| { |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
| private IPage _page; |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| |
|
54 |
| |
|
55 |
| |
|
56 |
| private IComponent _container; |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| private String _id; |
|
63 |
| |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
| |
|
69 |
| private String _idPath; |
|
70 |
| |
|
71 |
| private static final int MAP_SIZE = 5; |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
| |
|
77 |
| |
|
78 |
| private Map _bindings; |
|
79 |
| |
|
80 |
| private Map _components; |
|
81 |
| |
|
82 |
| private static final int BODY_INIT_SIZE = 5; |
|
83 |
| |
|
84 |
| private INamespace _namespace; |
|
85 |
| |
|
86 |
| |
|
87 |
| |
|
88 |
| |
|
89 |
| |
|
90 |
| private static final Map EMPTY_MAP = Collections.unmodifiableMap(new HashMap(1)); |
|
91 |
| |
|
92 |
| |
|
93 |
| |
|
94 |
| |
|
95 |
| |
|
96 |
| private int _bodyCount = 0; |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
| private IRender[] _body; |
|
103 |
| |
|
104 |
| |
|
105 |
| |
|
106 |
| |
|
107 |
| |
|
108 |
| private Map _assets; |
|
109 |
| |
|
110 |
| |
|
111 |
| |
|
112 |
| |
|
113 |
| |
|
114 |
| |
|
115 |
| |
|
116 |
| |
|
117 |
| private ListenerMap _listeners; |
|
118 |
| |
|
119 |
| |
|
120 |
| |
|
121 |
| |
|
122 |
| |
|
123 |
| |
|
124 |
| |
|
125 |
| private IBeanProvider _beans; |
|
126 |
| |
|
127 |
| |
|
128 |
| |
|
129 |
| |
|
130 |
| |
|
131 |
| |
|
132 |
| |
|
133 |
| |
|
134 |
| |
|
135 |
| private boolean _rendering; |
|
136 |
| |
|
137 |
| |
|
138 |
| |
|
139 |
| |
|
140 |
| |
|
141 |
| private boolean _active; |
|
142 |
| |
|
143 |
| |
|
144 |
| |
|
145 |
| private IContainedComponent _containedComponent; |
|
146 |
| |
|
147 |
159
| public void addAsset(String name, IAsset asset)
|
|
148 |
| { |
|
149 |
159
| Defense.notNull(name, "name");
|
|
150 |
159
| Defense.notNull(asset, "asset");
|
|
151 |
| |
|
152 |
159
| checkActiveLock();
|
|
153 |
| |
|
154 |
159
| if (_assets == null)
|
|
155 |
147
| _assets = new HashMap(MAP_SIZE);
|
|
156 |
| |
|
157 |
159
| _assets.put(name, asset);
|
|
158 |
| } |
|
159 |
| |
|
160 |
2658
| public void addComponent(IComponent component)
|
|
161 |
| { |
|
162 |
2658
| Defense.notNull(component, "component");
|
|
163 |
| |
|
164 |
2658
| checkActiveLock();
|
|
165 |
| |
|
166 |
2658
| if (_components == null)
|
|
167 |
564
| _components = new HashMap(MAP_SIZE);
|
|
168 |
| |
|
169 |
2658
| _components.put(component.getId(), component);
|
|
170 |
| } |
|
171 |
| |
|
172 |
| |
|
173 |
| |
|
174 |
| |
|
175 |
| |
|
176 |
| |
|
177 |
| |
|
178 |
| |
|
179 |
4791
| public void addBody(IRender element)
|
|
180 |
| { |
|
181 |
4791
| Defense.notNull(element, "element");
|
|
182 |
| |
|
183 |
| |
|
184 |
| |
|
185 |
| |
|
186 |
| |
|
187 |
| |
|
188 |
| |
|
189 |
| |
|
190 |
| |
|
191 |
| |
|
192 |
| |
|
193 |
4791
| if (_body == null)
|
|
194 |
| { |
|
195 |
1416
| _body = new IRender[BODY_INIT_SIZE];
|
|
196 |
1416
| _body[0] = element;
|
|
197 |
| |
|
198 |
1416
| _bodyCount = 1;
|
|
199 |
1416
| return;
|
|
200 |
| } |
|
201 |
| |
|
202 |
| |
|
203 |
| |
|
204 |
3375
| if (_bodyCount == _body.length)
|
|
205 |
| { |
|
206 |
261
| IRender[] newWrapped;
|
|
207 |
| |
|
208 |
261
| newWrapped = new IRender[_body.length * 2];
|
|
209 |
| |
|
210 |
261
| System.arraycopy(_body, 0, newWrapped, 0, _bodyCount);
|
|
211 |
| |
|
212 |
261
| _body = newWrapped;
|
|
213 |
| } |
|
214 |
| |
|
215 |
3375
| _body[_bodyCount++] = element;
|
|
216 |
| } |
|
217 |
| |
|
218 |
| |
|
219 |
| |
|
220 |
| |
|
221 |
| |
|
222 |
| |
|
223 |
2991
| public void finishLoad(IRequestCycle cycle, IPageLoader loader,
|
|
224 |
| IComponentSpecification specification) |
|
225 |
| { |
|
226 |
2991
| finishLoad();
|
|
227 |
| } |
|
228 |
| |
|
229 |
| |
|
230 |
| |
|
231 |
| |
|
232 |
| |
|
233 |
| |
|
234 |
| |
|
235 |
| |
|
236 |
| |
|
237 |
| |
|
238 |
| |
|
239 |
| |
|
240 |
| |
|
241 |
| |
|
242 |
| |
|
243 |
| |
|
244 |
| |
|
245 |
| |
|
246 |
| |
|
247 |
| |
|
248 |
| |
|
249 |
| |
|
250 |
| |
|
251 |
| |
|
252 |
| |
|
253 |
| |
|
254 |
4359
| protected void renderInformalParameters(IMarkupWriter writer, IRequestCycle cycle)
|
|
255 |
| { |
|
256 |
4359
| String attribute;
|
|
257 |
| |
|
258 |
4359
| if (_bindings == null)
|
|
259 |
102
| return;
|
|
260 |
| |
|
261 |
4257
| Iterator i = _bindings.entrySet().iterator();
|
|
262 |
| |
|
263 |
4257
| while (i.hasNext())
|
|
264 |
| { |
|
265 |
11937
| Map.Entry entry = (Map.Entry) i.next();
|
|
266 |
11937
| String name = (String) entry.getKey();
|
|
267 |
| |
|
268 |
11937
| if (isFormalParameter(name))
|
|
269 |
11709
| continue;
|
|
270 |
| |
|
271 |
228
| IBinding binding = (IBinding) entry.getValue();
|
|
272 |
| |
|
273 |
228
| Object value = binding.getObject();
|
|
274 |
228
| if (value == null)
|
|
275 |
0
| continue;
|
|
276 |
| |
|
277 |
228
| if (value instanceof IAsset)
|
|
278 |
| { |
|
279 |
0
| IAsset asset = (IAsset) value;
|
|
280 |
| |
|
281 |
| |
|
282 |
| |
|
283 |
0
| attribute = asset.buildURL();
|
|
284 |
| } |
|
285 |
| else |
|
286 |
228
| attribute = value.toString();
|
|
287 |
| |
|
288 |
228
| writer.attribute(name, attribute);
|
|
289 |
| } |
|
290 |
| |
|
291 |
| } |
|
292 |
| |
|
293 |
| |
|
294 |
11937
| private boolean isFormalParameter(String name)
|
|
295 |
| { |
|
296 |
11937
| Defense.notNull(name, "name");
|
|
297 |
| |
|
298 |
11937
| return getSpecification().getParameter(name) != null;
|
|
299 |
| } |
|
300 |
| |
|
301 |
| |
|
302 |
| |
|
303 |
| |
|
304 |
| |
|
305 |
| |
|
306 |
| |
|
307 |
| |
|
308 |
| |
|
309 |
| |
|
310 |
| |
|
311 |
62283
| public IBinding getBinding(String name)
|
|
312 |
| { |
|
313 |
62283
| Defense.notNull(name, "name");
|
|
314 |
| |
|
315 |
62283
| if (_bindings == null)
|
|
316 |
2610
| return null;
|
|
317 |
| |
|
318 |
59673
| return (IBinding) _bindings.get(name);
|
|
319 |
| } |
|
320 |
| |
|
321 |
| |
|
322 |
| |
|
323 |
| |
|
324 |
| |
|
325 |
| |
|
326 |
| |
|
327 |
465
| public boolean isParameterBound(String parameterName)
|
|
328 |
| { |
|
329 |
465
| Defense.notNull(parameterName, "parameterName");
|
|
330 |
| |
|
331 |
465
| return _bindings != null && _bindings.containsKey(parameterName);
|
|
332 |
| } |
|
333 |
| |
|
334 |
1827
| public IComponent getComponent(String id)
|
|
335 |
| { |
|
336 |
1827
| Defense.notNull(id, "id");
|
|
337 |
| |
|
338 |
1827
| IComponent result = null;
|
|
339 |
| |
|
340 |
1827
| if (_components != null)
|
|
341 |
1827
| result = (IComponent) _components.get(id);
|
|
342 |
| |
|
343 |
1827
| if (result == null)
|
|
344 |
0
| throw new ApplicationRuntimeException(Tapestry.format("no-such-component", this, id),
|
|
345 |
| this, null, null); |
|
346 |
| |
|
347 |
1827
| return result;
|
|
348 |
| } |
|
349 |
| |
|
350 |
93
| public IComponent getContainer()
|
|
351 |
| { |
|
352 |
93
| return _container;
|
|
353 |
| } |
|
354 |
| |
|
355 |
2697
| public void setContainer(IComponent value)
|
|
356 |
| { |
|
357 |
2697
| checkActiveLock();
|
|
358 |
| |
|
359 |
2697
| if (_container != null)
|
|
360 |
0
| throw new ApplicationRuntimeException(Tapestry
|
|
361 |
| .getMessage("AbstractComponent.attempt-to-change-container")); |
|
362 |
| |
|
363 |
2697
| _container = value;
|
|
364 |
| } |
|
365 |
| |
|
366 |
| |
|
367 |
| |
|
368 |
| |
|
369 |
| |
|
370 |
| |
|
371 |
| |
|
372 |
| |
|
373 |
600
| public String getExtendedId()
|
|
374 |
| { |
|
375 |
600
| if (_page == null)
|
|
376 |
228
| return null;
|
|
377 |
| |
|
378 |
372
| return _page.getPageName() + "/" + getIdPath();
|
|
379 |
| } |
|
380 |
| |
|
381 |
3099
| public String getId()
|
|
382 |
| { |
|
383 |
3099
| return _id;
|
|
384 |
| } |
|
385 |
| |
|
386 |
2688
| public void setId(String value)
|
|
387 |
| { |
|
388 |
2688
| if (_id != null)
|
|
389 |
0
| throw new ApplicationRuntimeException(Tapestry
|
|
390 |
| .getMessage("AbstractComponent.attempt-to-change-component-id")); |
|
391 |
| |
|
392 |
2688
| _id = value;
|
|
393 |
| } |
|
394 |
| |
|
395 |
624
| public String getIdPath()
|
|
396 |
| { |
|
397 |
624
| String containerIdPath;
|
|
398 |
| |
|
399 |
624
| if (_container == null)
|
|
400 |
0
| throw new NullPointerException(Tapestry
|
|
401 |
| .format("AbstractComponent.null-container", this)); |
|
402 |
| |
|
403 |
624
| containerIdPath = _container.getIdPath();
|
|
404 |
| |
|
405 |
624
| if (containerIdPath == null)
|
|
406 |
594
| _idPath = _id;
|
|
407 |
| else |
|
408 |
30
| _idPath = containerIdPath + "." + _id;
|
|
409 |
| |
|
410 |
624
| return _idPath;
|
|
411 |
| } |
|
412 |
| |
|
413 |
3975
| public IPage getPage()
|
|
414 |
| { |
|
415 |
3975
| return _page;
|
|
416 |
| } |
|
417 |
| |
|
418 |
3096
| public void setPage(IPage value)
|
|
419 |
| { |
|
420 |
3096
| if (_page != null)
|
|
421 |
0
| throw new ApplicationRuntimeException(Tapestry
|
|
422 |
| .getMessage("AbstractComponent.attempt-to-change-page")); |
|
423 |
| |
|
424 |
3096
| _page = value;
|
|
425 |
| } |
|
426 |
| |
|
427 |
| |
|
428 |
| |
|
429 |
| |
|
430 |
| |
|
431 |
5004
| public void renderBody(IMarkupWriter writer, IRequestCycle cycle)
|
|
432 |
| { |
|
433 |
5004
| for (int i = 0; i < _bodyCount; i++)
|
|
434 |
13572
| _body[i].render(writer, cycle);
|
|
435 |
| } |
|
436 |
| |
|
437 |
| |
|
438 |
| |
|
439 |
| |
|
440 |
| |
|
441 |
| |
|
442 |
| |
|
443 |
| |
|
444 |
4917
| public void setBinding(String name, IBinding binding)
|
|
445 |
| { |
|
446 |
4917
| Defense.notNull(name, "name");
|
|
447 |
4917
| Defense.notNull(binding, "binding");
|
|
448 |
| |
|
449 |
4917
| if (_bindings == null)
|
|
450 |
2517
| _bindings = new HashMap(MAP_SIZE);
|
|
451 |
| |
|
452 |
4917
| _bindings.put(name, binding);
|
|
453 |
| } |
|
454 |
| |
|
455 |
348
| public String toString()
|
|
456 |
| { |
|
457 |
348
| StringBuffer buffer;
|
|
458 |
| |
|
459 |
348
| buffer = new StringBuffer(super.toString());
|
|
460 |
| |
|
461 |
348
| buffer.append('[');
|
|
462 |
| |
|
463 |
348
| buffer.append(getExtendedId());
|
|
464 |
| |
|
465 |
348
| buffer.append(']');
|
|
466 |
| |
|
467 |
348
| return buffer.toString();
|
|
468 |
| } |
|
469 |
| |
|
470 |
| |
|
471 |
| |
|
472 |
| |
|
473 |
| |
|
474 |
| |
|
475 |
6798
| public Map getComponents()
|
|
476 |
| { |
|
477 |
6798
| if (_components == null)
|
|
478 |
4827
| return EMPTY_MAP;
|
|
479 |
| |
|
480 |
1971
| return Collections.unmodifiableMap(_components);
|
|
481 |
| |
|
482 |
| } |
|
483 |
| |
|
484 |
81
| public Map getAssets()
|
|
485 |
| { |
|
486 |
81
| if (_assets == null)
|
|
487 |
0
| return EMPTY_MAP;
|
|
488 |
| |
|
489 |
81
| return Collections.unmodifiableMap(_assets);
|
|
490 |
| } |
|
491 |
| |
|
492 |
555
| public IAsset getAsset(String name)
|
|
493 |
| { |
|
494 |
555
| if (_assets == null)
|
|
495 |
393
| return null;
|
|
496 |
| |
|
497 |
162
| return (IAsset) _assets.get(name);
|
|
498 |
| } |
|
499 |
| |
|
500 |
18
| public Collection getBindingNames()
|
|
501 |
| { |
|
502 |
| |
|
503 |
| |
|
504 |
18
| if (_container == null)
|
|
505 |
0
| return null;
|
|
506 |
| |
|
507 |
18
| HashSet result = new HashSet();
|
|
508 |
| |
|
509 |
| |
|
510 |
| |
|
511 |
18
| if (_bindings != null)
|
|
512 |
6
| result.addAll(_bindings.keySet());
|
|
513 |
| |
|
514 |
| |
|
515 |
| |
|
516 |
| |
|
517 |
18
| List names = getSpecification().getParameterNames();
|
|
518 |
| |
|
519 |
18
| int count = names.size();
|
|
520 |
| |
|
521 |
18
| for (int i = 0; i < count; i++)
|
|
522 |
| { |
|
523 |
3
| String name = (String) names.get(i);
|
|
524 |
| |
|
525 |
3
| if (result.contains(name))
|
|
526 |
3
| continue;
|
|
527 |
| |
|
528 |
0
| if (getBinding(name) != null)
|
|
529 |
0
| result.add(name);
|
|
530 |
| } |
|
531 |
| |
|
532 |
18
| return result;
|
|
533 |
| } |
|
534 |
| |
|
535 |
| |
|
536 |
| |
|
537 |
| |
|
538 |
| |
|
539 |
| |
|
540 |
| |
|
541 |
0
| public Map getBindings()
|
|
542 |
| { |
|
543 |
0
| if (_bindings == null)
|
|
544 |
0
| return Collections.EMPTY_MAP;
|
|
545 |
| |
|
546 |
0
| return Collections.unmodifiableMap(_bindings);
|
|
547 |
| } |
|
548 |
| |
|
549 |
| |
|
550 |
| |
|
551 |
| |
|
552 |
| |
|
553 |
| |
|
554 |
| |
|
555 |
| |
|
556 |
| |
|
557 |
84
| public ListenerMap getListeners()
|
|
558 |
| { |
|
559 |
| |
|
560 |
| |
|
561 |
| |
|
562 |
| |
|
563 |
84
| if (_listeners == null)
|
|
564 |
72
| _listeners = getPage().getEngine().getInfrastructure().getListenerMapSource()
|
|
565 |
| .getListenerMapForObject(this); |
|
566 |
| |
|
567 |
84
| return _listeners;
|
|
568 |
| } |
|
569 |
| |
|
570 |
| |
|
571 |
| |
|
572 |
| |
|
573 |
| |
|
574 |
| |
|
575 |
| |
|
576 |
| |
|
577 |
456
| public IBeanProvider getBeans()
|
|
578 |
| { |
|
579 |
456
| if (_beans == null)
|
|
580 |
126
| _beans = new BeanProvider(this);
|
|
581 |
| |
|
582 |
456
| return _beans;
|
|
583 |
| } |
|
584 |
| |
|
585 |
| |
|
586 |
| |
|
587 |
| |
|
588 |
| |
|
589 |
| |
|
590 |
| |
|
591 |
| |
|
592 |
| |
|
593 |
2793
| protected void finishLoad()
|
|
594 |
| { |
|
595 |
| } |
|
596 |
| |
|
597 |
| |
|
598 |
| |
|
599 |
| |
|
600 |
| |
|
601 |
| |
|
602 |
| |
|
603 |
| |
|
604 |
| |
|
605 |
| |
|
606 |
| |
|
607 |
| |
|
608 |
| |
|
609 |
7632
| public final void render(IMarkupWriter writer, IRequestCycle cycle)
|
|
610 |
| { |
|
611 |
7632
| try
|
|
612 |
| { |
|
613 |
7632
| _rendering = true;
|
|
614 |
| |
|
615 |
7632
| prepareForRender(cycle);
|
|
616 |
| |
|
617 |
7626
| renderComponent(writer, cycle);
|
|
618 |
| } |
|
619 |
| finally |
|
620 |
| { |
|
621 |
7632
| _rendering = false;
|
|
622 |
| |
|
623 |
7632
| cleanupAfterRender(cycle);
|
|
624 |
| } |
|
625 |
| } |
|
626 |
| |
|
627 |
| |
|
628 |
| |
|
629 |
| |
|
630 |
| |
|
631 |
| |
|
632 |
| |
|
633 |
| |
|
634 |
| |
|
635 |
7311
| protected void prepareForRender(IRequestCycle cycle)
|
|
636 |
| { |
|
637 |
| } |
|
638 |
| |
|
639 |
| |
|
640 |
| |
|
641 |
| |
|
642 |
| |
|
643 |
| |
|
644 |
| |
|
645 |
| |
|
646 |
| protected abstract void renderComponent(IMarkupWriter writer, IRequestCycle cycle); |
|
647 |
| |
|
648 |
| |
|
649 |
| |
|
650 |
| |
|
651 |
| |
|
652 |
| |
|
653 |
| |
|
654 |
| |
|
655 |
7311
| protected void cleanupAfterRender(IRequestCycle cycle)
|
|
656 |
| { |
|
657 |
| } |
|
658 |
| |
|
659 |
5103
| public INamespace getNamespace()
|
|
660 |
| { |
|
661 |
5103
| return _namespace;
|
|
662 |
| } |
|
663 |
| |
|
664 |
3072
| public void setNamespace(INamespace namespace)
|
|
665 |
| { |
|
666 |
3072
| _namespace = namespace;
|
|
667 |
| } |
|
668 |
| |
|
669 |
| |
|
670 |
| |
|
671 |
| |
|
672 |
| |
|
673 |
| |
|
674 |
| |
|
675 |
| |
|
676 |
| |
|
677 |
| |
|
678 |
0
| public IRender[] getBody()
|
|
679 |
| { |
|
680 |
0
| return _body;
|
|
681 |
| } |
|
682 |
| |
|
683 |
| |
|
684 |
| |
|
685 |
| |
|
686 |
| |
|
687 |
| |
|
688 |
| |
|
689 |
| |
|
690 |
0
| public int getBodyCount()
|
|
691 |
| { |
|
692 |
0
| return _bodyCount;
|
|
693 |
| } |
|
694 |
| |
|
695 |
| |
|
696 |
| |
|
697 |
| |
|
698 |
| |
|
699 |
| |
|
700 |
| |
|
701 |
| |
|
702 |
| |
|
703 |
| |
|
704 |
0
| public void pageEndRender(PageEvent event)
|
|
705 |
| { |
|
706 |
| } |
|
707 |
| |
|
708 |
| |
|
709 |
| |
|
710 |
| |
|
711 |
| |
|
712 |
| |
|
713 |
| |
|
714 |
| |
|
715 |
66
| public void setProperty(String propertyName, Object value)
|
|
716 |
| { |
|
717 |
66
| PropertyUtils.write(this, propertyName, value);
|
|
718 |
| } |
|
719 |
| |
|
720 |
| |
|
721 |
| |
|
722 |
| |
|
723 |
| |
|
724 |
| |
|
725 |
| |
|
726 |
| |
|
727 |
12
| public Object getProperty(String propertyName)
|
|
728 |
| { |
|
729 |
12
| return PropertyUtils.read(this, propertyName);
|
|
730 |
| } |
|
731 |
| |
|
732 |
| |
|
733 |
| |
|
734 |
| |
|
735 |
| |
|
736 |
11166
| public final boolean isRendering()
|
|
737 |
| { |
|
738 |
11166
| return _rendering;
|
|
739 |
| } |
|
740 |
| |
|
741 |
| |
|
742 |
| |
|
743 |
| |
|
744 |
| |
|
745 |
| |
|
746 |
| |
|
747 |
| |
|
748 |
3531
| protected final boolean isInActiveState()
|
|
749 |
| { |
|
750 |
3531
| return _active;
|
|
751 |
| } |
|
752 |
| |
|
753 |
| |
|
754 |
2985
| public final void enterActiveState()
|
|
755 |
| { |
|
756 |
2985
| _active = true;
|
|
757 |
| } |
|
758 |
| |
|
759 |
| |
|
760 |
| |
|
761 |
5514
| protected final void checkActiveLock()
|
|
762 |
| { |
|
763 |
5514
| if (_active)
|
|
764 |
0
| throw new UnsupportedOperationException(TapestryMessages.componentIsLocked(this));
|
|
765 |
| } |
|
766 |
| |
|
767 |
3
| public Messages getMessages()
|
|
768 |
| { |
|
769 |
3
| throw new IllegalStateException(TapestryMessages.providedByEnhancement("getMessages"));
|
|
770 |
| } |
|
771 |
| |
|
772 |
3
| public IComponentSpecification getSpecification()
|
|
773 |
| { |
|
774 |
3
| throw new IllegalStateException(TapestryMessages.providedByEnhancement("getSpecification"));
|
|
775 |
| } |
|
776 |
| |
|
777 |
| |
|
778 |
| |
|
779 |
| |
|
780 |
| |
|
781 |
| |
|
782 |
| |
|
783 |
| |
|
784 |
3
| public String getMessage(String key)
|
|
785 |
| { |
|
786 |
3
| return getMessages().getMessage(key);
|
|
787 |
| } |
|
788 |
| |
|
789 |
| |
|
790 |
| |
|
791 |
| |
|
792 |
| |
|
793 |
| |
|
794 |
| |
|
795 |
| |
|
796 |
| |
|
797 |
| |
|
798 |
| |
|
799 |
| |
|
800 |
| |
|
801 |
3
| public String format(String key, Object[] arguments)
|
|
802 |
| { |
|
803 |
3
| return getMessages().format(key, arguments);
|
|
804 |
| } |
|
805 |
| |
|
806 |
| |
|
807 |
| |
|
808 |
| |
|
809 |
| |
|
810 |
| |
|
811 |
| |
|
812 |
| |
|
813 |
3
| public String format(String key, Object argument)
|
|
814 |
| { |
|
815 |
3
| return getMessages().format(key, argument);
|
|
816 |
| } |
|
817 |
| |
|
818 |
| |
|
819 |
| |
|
820 |
| |
|
821 |
| |
|
822 |
| |
|
823 |
| |
|
824 |
| |
|
825 |
3
| public String format(String key, Object argument1, Object argument2)
|
|
826 |
| { |
|
827 |
3
| return getMessages().format(key, argument1, argument2);
|
|
828 |
| } |
|
829 |
| |
|
830 |
| |
|
831 |
| |
|
832 |
| |
|
833 |
| |
|
834 |
| |
|
835 |
| |
|
836 |
| |
|
837 |
3
| public String format(String key, Object argument1, Object argument2, Object argument3)
|
|
838 |
| { |
|
839 |
3
| return getMessages().format(key, argument1, argument2, argument3);
|
|
840 |
| } |
|
841 |
| |
|
842 |
| |
|
843 |
3
| public final IContainedComponent getContainedComponent()
|
|
844 |
| { |
|
845 |
3
| return _containedComponent;
|
|
846 |
| } |
|
847 |
| |
|
848 |
| |
|
849 |
2667
| public final void setContainedComponent(IContainedComponent containedComponent)
|
|
850 |
| { |
|
851 |
2667
| Defense.notNull(containedComponent, "containedComponent");
|
|
852 |
| |
|
853 |
2667
| if (_containedComponent != null)
|
|
854 |
3
| throw new ApplicationRuntimeException(TapestryMessages
|
|
855 |
| .attemptToChangeContainedComponent(this)); |
|
856 |
| |
|
857 |
2664
| _containedComponent = containedComponent;
|
|
858 |
| } |
|
859 |
| |
|
860 |
| } |