This exception happens intermittently. I'll try to build a standalone example to reporiduce it but maybe this is a known issue.
It happens when I repeatedly add and remove the components to the parent component which has RowLayout set to it and calling Viewport.layout() after each such an iteration.
Obviously the exact logic is much more complex.
What prompts me to think that this is a bug is that if I replace the RowLayout with BorderLayout it works just fine.
java.lang.ClassCastException: com.extjs.gxt.ui.client.widget.layout.BorderLayout Data
at com.extjs.gxt.ui.client.widget.layout.RowLayout.la youtVertical(RowLayout.java:163) java.lang.ClassCastException: com.extjs.gxt.ui.client.widget :: java.lang.ClassCastException: com.extjs.gxt.ui.client.widget.layout.BorderLayout Data Gxt: Premium Help. http://extjs.com/forum/showthread.php?t=40609HOME |
at com.extjs.gxt.ui.client.widget.layout.RowLayout.on Layout(RowLayout.java:212)
at com.extjs.gxt.ui.client.widget.Layout.layout(Layou t.java:71)
at com.extjs.gxt.ui.client.widget.Layout$1.handleEven t(Layout.java:48)
at com.extjs.gxt.ui.client.widget.Layout$1.handleEven t(Layout.java:1)
at com.extjs.gxt.ui.client.event.BaseObservable.fireE vent(BaseObservable.java:74)
at com.extjs.gxt.ui.client.widget.Component.fireEvent (Component.java:403)
at com.extjs.gxt.ui.client.widget.BoxComponent.setSiz e(BoxComponent.java:411)
at com.extjs.gxt.ui.client.widget.Layout.setSize(Layo ut.java:208)
at com.extjs.gxt.ui.client.widget.layout.RowLayout.la youtVertical(RowLayout.java:201) java.lang.ClassCastException: com.extjs.gxt.ui.client.widget :: If you have any other info about java.lang.ClassCastException: com.extjs.gxt.ui.client.widget.layout.BorderLayout Data , Please add it free. http://enart.mercebank.com/dis/discounts-313185.htmHOME | [FIXED] Binding in TimeField - Ext JS Forums:: [ERROR] Uncaught exception escaped java.lang.ClassCastException: java.lang. Button; import com.extjs.gxt.ui.client.widget.layout.BorderLayout http://yui-ext.com/forum/showthread.php?p=259273HOME |
I guess the situation in which this could happen (when reusing the container) is as follows:
- set the BorderLayout to the container
- add components
- call ViewPort.layout()
- do some work
- remove components with removeAll(). Tthis doesn't force components to be removed: [FIXED] Binding in TimeField - Ext JS Forums:: 2 posts - 2 authors - Last post: Dec 4, 2008[ERROR] Uncaught exception escaped java.lang.ClassCastException: java.lang. BorderLayout; import com.extjs.gxt.ui.client.widget.layout. . However, you would normall use a Converter to translate data types form http://extjs.com/forum/showthread.php?t=54397HOME |
// from Container.java
public boolean removeAll() {
return removeAll(false);
}
- set the RowLayout to the container
- add components
- call ViewPort.layout()
- get the exception since there is (potentially) a component that has BorderLayoutData set on it.
Is this something that you could/will look in to or should I just avoid reuse of the container?
After a container is rendered, adding and removing children will not update the UI. The UI will be updated when container's layout is executed. Another approach is to call setLayoutOnChange(true) to have the container's layout execute any time there is a change to the children of the container.
After the container has been rendered, this is true. You need to call layout().
Could you please explain? I need to call removeAll() followed by the layout() to force the removal, is this what you mean?
RowLayout expects RowData. It looks like the layout data is BorderLayoutData which is why the class cast exception occurs.
I am not sure I understand you question. Containers can be reused, however, when changing layouts, the children must use the appropriate layout data.
remove components with removeAll(). Tthis doesn't force components to be removed:
After the container has been rendered, this is true. You need to call layout().
Nortel Unveils Vision, Strategy for Israeli High-Performance Net
Busy Friday Leads to Strong Close for Net Stocks
|