Dashboard: exception when drag-n-drop

Hi
I have successfully added the dashboard add-on to my project. But now I have encountered an exception and have a question below:

  1. I am able to create a Widget that is shown under the widget Template as below:
    06%20AM

when I drag “salesWidget(screen)” to my dashboard layout, I get the following exception:

    java.lang.ClassCastException: com.company.demodashboard.web.dashboard.Saleswidget cannot be cast to com.haulmont.cuba.gui.components.Window
	at com.haulmont.cuba.gui.components.WindowDelegate.wrapBy(WindowDelegate.java:78)
	at com.haulmont.cuba.web.gui.WebWindow.wrapBy(WebWindow.java:1371)
	at com.haulmont.cuba.gui.WindowManager.wrapByCustomClass(WindowManager.java:1204)
	at com.haulmont.cuba.gui.WindowManager.createWindow(WindowManager.java:561)
	at com.haulmont.cuba.gui.WindowManager.openWindow(WindowManager.java:750)
	at com.haulmont.cuba.web.WebWindowManager.openWindow(WebWindowManager.java:158)
	at com.haulmont.cuba.web.gui.components.WebFrame.openWindow(WebFrame.java:298)
	at com.haulmont.cuba.gui.components.AbstractFrame.openWindow(AbstractFrame.java:484)
	at com.haulmont.addon.dashboard.web.widget.screen.ScreenWidget.init(ScreenWidget.java:66)
	at com.haulmont.cuba.gui.xml.layout.loaders.FrameLoader$FrameLoaderInitTask.execute(FrameLoader.java:271)
	at com.haulmont.cuba.gui.xml.layout.loaders.ComponentLoaderContext$InitTaskExecutor.run(ComponentLoaderContext.java:273)
	at com.haulmont.cuba.gui.xml.layout.loaders.ComponentLoaderContext.executeInitTasks(ComponentLoaderContext.java:162)
	at com.haulmont.cuba.gui.WindowManager.openFrame(WindowManager.java:1014)
	at com.haulmont.cuba.gui.WindowManager.openFrame(WindowManager.java:964)
	at com.haulmont.cuba.web.gui.components.WebFrame.openFrame(WebFrame.java:412)
	at com.haulmont.cuba.gui.components.AbstractFrame.openFrame(AbstractFrame.java:569)
	at com.haulmont.addon.dashboard.web.dashboard.tools.componentfactory.CanvasUiComponentsFactory.createCanvasWidgetLayout(CanvasUiComponentsFactory.java:114)
	at com.haulmont.addon.dashboard.web.dashboard.tools.componentfactory.CanvasDropComponentsFactory.createCanvasWidgetLayout(CanvasDropComponentsFactory.java:118)
	at com.haulmont.addon.dashboard.web.dashboard.tools.DashboardModelConverter.modelToContainer(DashboardModelConverter.java:72)
	at com.haulmont.addon.dashboard.web.dashboard.tools.DashboardModelConverter.modelToContainer(DashboardModelConverter.java:100)
	at com.haulmont.addon.dashboard.web.dashboard.tools.DashboardModelConverter.modelToContainer(DashboardModelConverter.java:100)
	at com.haulmont.addon.dashboard.web.dashboard.frames.editor.canvas.CanvasFrame.updateLayout(CanvasFrame.java:76)
	at com.haulmont.addon.dashboard.web.dashboard.frames.editor.canvas.CanvasEditorFrame.updateLayout(CanvasEditorFrame.java:64)
	at com.haulmont.addon.dashboard.web.dashboard.frames.editor.canvas.CanvasEditorFrame.onLayoutRefreshedEvent(CanvasEditorFrame.java:100)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter.doInvoke(UiEventListenerMethodAdapter.java:211)
	at com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter.processEvent(UiEventListenerMethodAdapter.java:137)
	at com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter.onApplicationEvent(UiEventListenerMethodAdapter.java:96)
	at com.haulmont.cuba.gui.events.sys.UiEventsMulticasterImpl.invokeListener(UiEventsMulticasterImpl.java:73)
	at com.haulmont.cuba.gui.events.sys.UiEventsMulticasterImpl.multicastEvent(UiEventsMulticasterImpl.java:66)
	at com.haulmont.cuba.web.sys.WebEvents.publish(WebEvents.java:31)
	at com.haulmont.addon.dashboard.web.dashboard.tools.DropLayoutTools.reorderWidgetsAndPushEvents(DropLayoutTools.java:138)
	at com.haulmont.addon.dashboard.web.dashboard.tools.DropLayoutTools.addComponent(DropLayoutTools.java:112)
	at com.haulmont.addon.dashboard.web.dashboard.frames.editor.DashboardEdit.widgetAddedToTreeEventListener(DashboardEdit.java:361)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter.doInvoke(UiEventListenerMethodAdapter.java:211)
	at com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter.processEvent(UiEventListenerMethodAdapter.java:137)
	at com.haulmont.cuba.gui.events.sys.UiEventListenerMethodAdapter.onApplicationEvent(UiEventListenerMethodAdapter.java:96)
	at com.haulmont.cuba.gui.events.sys.UiEventsMulticasterImpl.invokeListener(UiEventsMulticasterImpl.java:73)
	at com.haulmont.cuba.gui.events.sys.UiEventsMulticasterImpl.multicastEvent(UiEventsMulticasterImpl.java:66)
	at com.haulmont.cuba.web.sys.WebEvents.publish(WebEvents.java:31)
	at com.haulmont.addon.dashboard.web.dashboard.tools.drophandler.TreeDropHandler.drop(TreeDropHandler.java:66)
  1. How can I create Widgets that shows up in under the Widgets like you have in the demo application?
    00%20AM

I have attached a demo application with necessary Entity and screens for additional information.

Thanks for your help.
demoDashboard.zip (97.1 KB)

regards

Hi,

Please change the widget template type to Sales.
Also please extend hover theme via CUBA studio

Hi Evgeny
Hover theme is already selected as you will see in the demo app I have shared.
I am not sure how/where I change the widget template type to Sales, sorry for my limited knowledge to this but your help would be appreciated.

Hi,

To extend theme you need to press Manage theme -> Create theme extension action in your CUBA Studio.
To change widget template type you need open Dashboard->Widget templates browser, then select your template and change type to Sales

Thanks. Fortunately, I see it is working today before I have done the above. It was probably the project was not compiled correctly for some unknown reason. Anyways, I shall follow what you have suggested.