|
From: Arne L. (JIRA) <no...@at...> - 2006-11-03 14:43:49
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-437?page=comments#action_20626 ] Arne Limburg commented on RCP-437: ---------------------------------- Your pageComponent could not be activated throw the code. Whenever you get a ViewDescriptor of one of your pageComponents and call showView on DesktopApplicationPage a new JInternalFrame is created. You should really consider to have one ViewDescriptor for every of your TradeViews. What about this solution: You can control wether to create a new Frame via setting the tradeId. For every TradeId there is exactly one View if this is not desired you should override getId() of your viewdescriptor to return something else that is unique for a single view. public class TradeViewDescriptor extends DefaultViewDescriptor { private int tradeId; [...] public int getTradeId() { return tradeId; } public void setTradeId(int tradeId) { this.tradeId = tradeId; } public String getId() { return super.getId() + tradeId; } } public class TradeView implements View { public int getTradeId() { return ((TradeViewDescriptor)getDescriptor()).getTradeId(); } public void setTradeId(int tradeId) { ((TradeViewDescriptor)getDescriptor()).setTradeId(tradeId); } } public class NonSingletonViewRegistry extends BeanFactoryViewRegistry { private List viewDescriptors = new ArrayList(); public ViewDescriptor[] getViewDescriptors() { ViewDescriptor[] beanViewDescriptors = super.getViewDescriptors(); ViewDescriptor[] viewDescriptors = new ViewDescriptor[this.viewDescriptors.size() + beanViewDescriptors.length]; this.viewDescriptors.toArray(viewDescriptors); System.arraycopy(beanViewDescriptors, 0, viewDescriptors, this.viewDescriptors.size(), beanViewDescriptors.length); return viewDescriptors; } public ViewDescriptor getViewDescriptor(String viewName) { ViewDescriptor viewDescriptor = findViewDescriptor(viewName); if (viewDescriptor != null) return viewDescriptor; viewDescriptor = super.getViewDescriptor(viewName); viewDescriptors.add(viewDescriptor); return viewDescriptor; } protected ViewDescriptor findViewDescriptor(String viewName) { for (Iterator i = viewDescriptors.iterator(); i.hasNext();) { ViewDescriptor viewDescriptor = (ViewDescriptor)i.next(); if (viewDescriptor.getId().equals(viewName)) return viewDescriptor; } return null; } } > Enable multiple instances of MDI frames for same view. > ------------------------------------------------------ > > Key: RCP-437 > URL: http://opensource.atlassian.com/projects/spring/browse/RCP-437 > Project: Spring Framework Rich Client Project > Type: Improvement > Versions: 0.3.0 > Reporter: Benoit Xhenseval > Attachments: DesktipApplicationPage.java.patch > > Hi > I'd like to propose a patch that is backward compatible with the existing code. > The patch allows several MDI windows for the same view (say "TradeView", traders would like to see more than 1). > At the moment, this is not possible. > This is simply done by looking up for the singleton property in the Spring XML config for the requested view. > If the view is a singleton and an instance already exists, it returns it. > If it does not exist or is not a singleton, DesktopApplicationPage.findPageComponent returns null which then indicates to SpringRC to build a new one. > I'd be grateful if you'd consider it for inclusion in the mdi package in the sandbox. > Thanks > Benoit -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |