
| Key: |
LPP-4007
|
| Type: |
Task
|
| Status: |
Closed
|
| Resolution: |
Won't Fix
|
| Priority: |
--
|
| Assignee: |
Unassigned
|
| Reporter: |
Benjamin Shine
|
| Votes: |
0
|
| Watchers: |
3
|
|
If you were logged in you would be able to see more operations.
|
|
|
| Severity: |
Minor
|
| Runtime: |
N/A
|
| Fix in hand: |
False
|
|
from email by ptw: drawview is doing its construction in an onconstruct handler, so it is not really fully constructed until _after_ onconstruct. Is this a common pattern? Probably people are leery of overriding the construct method (which should achieve the same effect), but I don't think that is right. `onconstruct` is supposed to signal that the instance is fully constructed, which won't be true if your class is going to do more construction in onconstruct.
I really don't like sprinkling `if (this.isinited)` around all your event handlers. It should not be necessary. It's overhead on every event that you only need during construction.
Should we have a guideline that says you should not use onconstruct to do construction? That you have to do that by overriding the construct method? (It's really not that scary.)
Does someone want to make the experiment of rewriting drawview to override construct? (You have to invoke the super method first, before you do any of your own construction:
super.construct.apply(this, arguments);
then you should be able to remove all the `if (this.isinited)` in handlers.
|
|
Description
|
from email by ptw: drawview is doing its construction in an onconstruct handler, so it is not really fully constructed until _after_ onconstruct. Is this a common pattern? Probably people are leery of overriding the construct method (which should achieve the same effect), but I don't think that is right. `onconstruct` is supposed to signal that the instance is fully constructed, which won't be true if your class is going to do more construction in onconstruct.
I really don't like sprinkling `if (this.isinited)` around all your event handlers. It should not be necessary. It's overhead on every event that you only need during construction.
Should we have a guideline that says you should not use onconstruct to do construction? That you have to do that by overriding the construct method? (It's really not that scary.)
Does someone want to make the experiment of rewriting drawview to override construct? (You have to invoke the super method first, before you do any of your own construction:
super.construct.apply(this, arguments);
then you should be able to remove all the `if (this.isinited)` in handlers.
|
Show » |
|
solating further, the problem comes down to calling drawview.clear() before the drawview is completely built. This code snippet demonstrates the problem; running in dhtml gives a debugger error,
ERROR: http://localhost:8080/legals/test/drawing/drawing.lzx?lzt=object&lzt=object&debug=true&lzr=dhtml&_canvas_debug=true:188: this.context has no properties
<drawview width="200" height="200">
<handler name="onwidth">
<![CDATA[
this.drawStructure();
]]>
</handler>
<method name="drawStructure">
this.clear();
</method>
</drawview>