ClassCastException from a bean when using the Web Client

Hi everybody,

I have developed a Drag and Drop bean. It works perfectly using the Smart Client but when I’m starting the Web Client the from can’t be setup because the bean can’t be cast:

java.lang.ClassCastException: com.assetguardian.FileDndBean cannot be cast to org.apache.wicket.Component

The biggest problem is that it crashes the Web-Client. So to have both Smart and Web Client working I have to remove my bean code :(

You have to lean wicket to be able to use the bean in webclient…

IT2Be:
You have to lean wicket to be able to use the bean in webclient…

What do you mean by “lean wicket” ? :shock:

lean = learn

For info on book on Wicket see:

viewtopic.php?f=17&t=12072

Dean Westover
Choices Software, Inc.

I have quickly read some examples of wickets.

If I want to integrate my bean into the web client application, does it mean that I have to implement my own webapplication?
I can’t modify my bean to make it working on both smart client and web clent? :shock:

I can’t modify my bean to make it working on both smart client and web clent?

Yes you can (although I don’t know if drag 'n drop is supported by wicket).

The easiest thing to do is create an interface and, based on the servoy client type use Swing or WIcket.

IT2Be:
Yes you can (although I don’t know if drag 'n drop is supported by wicket).

In fact it’s not that important if If the drag and drop doesn’t work on the web client (I’m 99.9% sure it will not). But I don’t want my application to crash because of that.

When you implement getBeanInstance from IServoyBeanFactory you have parameter servoy_application_type; so you probably would do something like:

if (servoy_application_type == IApplication.WEB_CLIENT || servoy_application_type == IApplication.HEADLESS_CLIENT)
{
	return createWicketComponent();
}
else
{
	return createSwingComponent();
}

You can also return null if needed.

lvostinar:
When you implement getBeanInstance from IServoyBeanFactory you have parameter servoy_application_type; so you probably would do something like:
You can also return null if needed.

Very interesting!

But which parameter is servoy_application_type?
I didn’t found any details about the IServoyBeanFactory class in the API.
Here is my getBeanInstance declaration:

public IComponent getBeanInstance(int arg0, IClientPluginAccess arg1,
			Object[] arg2) {
...
}

arg0 is servoy_application_type

lvostinar:
arg0 is servoy_application_type

Seems to work now!

I get a page with some kind of textarea, where my bean is, with the message:

bean missing com.assetguardian.FileDndBeanFactory

Is that normal or it should do something else?
At least it doesn’t crash :lol:

Foobrother:

lvostinar:
arg0 is servoy_application_type

Seems to work now!

I get a page with some kind of textarea, where my bean is, with the message:

bean missing com.assetguardian.FileDndBeanFactory

Is that normal or it should do something else?
At least it doesn’t crash :lol:

Yes, that is default if you return null. If you want something different you have to implement the wicket component.

lvostinar:
Yes, that is default if you return null. If you want something different you have to implement the wicket component.

Ok :-)

I don’t need to make it work on the web client. So I’ll try to implement the wicket component another time! :lol:

Cheers guys :wink: