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