Valkyrie-RCP
Valkyrie-RCP copied to clipboard
Problem with same view multiple times
I'm trying to find a way to show the same view but with different input object at the same time to make comparisons. I can't find a way to do this. There is any way to do this?
Thanks in advance
Not as far as I know, you will have to create a "duplicate" view with a different view id.
Thanks for the answer. Is exactly what I'm doing dynamic because can be two or more the same view with different data. But I have to register the descriptors in the bean pool to be able to open it. Maybe this is something that should be implemented.
Something like this:
public DefaultViewDescriptor createDynamicView(Class<? extends View> classz, String viewId) { try { AbstractBeanDefinition beanDef = BeanDefinitionReaderUtils.createBeanDefinition(null, DefaultViewDescriptor.class.getName(), ClassLoader.getSystemClassLoader()); ConstructorArgumentValues cArgs = new ConstructorArgumentValues(); cArgs.addIndexedArgumentValue(0, viewId); cArgs.addIndexedArgumentValue(1, classz); beanDef.setConstructorArgumentValues(cArgs); DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) applicationConfig.applicationContext().getAutowireCapableBeanFactory(); beanFactory.registerBeanDefinition(viewId, beanDef); return (DefaultViewDescriptor) beanFactory.getBean(viewId); } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; }
Do you think there is a better way to do this?
Thanks
Why not just declare the extra view statically?
It's no just an extra view. Is the same view that the user can open every time he want.
I just can not see how you can do it without a copy assuming that you want to have to view/panels with the view open simultaneously. The Swing components hosted in the view can only have a single parent and createDynamicView also seems to create a new instance? But maybe I have misunderstood something.
What do you mean with a copy? I have several views open somultaneously. The component hosted in the view need a new instance for each view because have different information inside. I will interact with this component simultaneously in each view. What createDynamicView is create a new instance of the view and in other method this view is open. It's a little complicated to explain. :(