Community
Participate
Working Groups
Created attachment 209010 [details] Patch implementing the PROPOSED SOLUTION Build Identifier: 3.7.0.2011-Jun 2011 PROBLEM DESCRIPTION: XML I/O on IForm (IForm.storeXML and IForm.loadXML) does not work properly for IFormFields with a non-unique class name. F.e. if a SearchForm with two tabs which both contains a TextField with the same class name. EVALUATION: The problem is located in IFormField.storeXML and IForm.storeXML where the field ID is always treated as "getClass().getSimpleName()". This leads to the known problem with same-named fields in different parent classes (f.e. tabs). PROPOSED SOLUTION: The IFromField provide a method getXMLFieldId which will be used for XML I/O. This method will return the fields simple class name by default and can be overridden if a special handling (f.e. same-named fields in different parent classes) is needed. The attached patch adds this method and makes use of it in IFormField.storeXML and IForm.storeXML. Reproducible: Always
With the proposed solution the method getXMLFieldId() has to be overwritten for all ambiguous fields, which is very unpractical. Problems caused by ambiguous fields will only be detected on runtime. A hierarchical structure would solve the ambiguity problem, but would make the loading less lenient. In the current implementation it is possible to move a field to another group box or to rename a group box without migrating the xml file. This would not be possible when using the complete hierarchical structure. I changed the proposed solution such that a field is identified by its simple name and as many parent names as necessary to make it unique. This should work for most cases by default and allow a lot of refactoring without migration. It is still possible to set a custom XMLFieldId by overriding org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField.getXMLFieldId(), if needed. Loading older XML files with ambiguous fields is still possible: Data is imported to the first field found (as before). Migration:None
Please review & test. Is this ticket needed for a branch?
Created attachment 213292 [details] Patch set form on listbox and treebox fields
Fixed bug reported by Claudio Guglielmo. Exception in BookmarkUtility, if form is not set on a field. In this case a fallback to the simple name is used. Listboxes and treeboxes contain fields that are visited without a form. The form should probably be set there as well. See attached patch. at org.eclipse.scout.rt.client.ui.form.AbstractForm.getXML(AbstractForm.java:1786) at org.eclipse.scout.rt.client.services.common.bookmark.internal.BookmarkUtility.bmStoreTablePage(BookmarkUtility.java:603) at org.eclipse.scout.rt.client.services.common.bookmark.internal.BookmarkUtility.createBookmark(BookmarkUtility.java:400) at org.eclipse.scout.rt.client.services.common.bookmark.internal.BookmarkUtility.createBookmark(BookmarkUtility.java:307) at org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop.createBookmark(AbstractDesktop.java:1399) at org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm$ModifyHandler.execLoad(OrganizeColumnsForm.java:1159) at org.eclipse.scout.rt.client.ui.form.AbstractFormHandler.onLoad(AbstractFormHandler.java:181) at org.eclipse.scout.rt.client.ui.form.AbstractForm.loadStateInternal(AbstractForm.java:1136) at org.eclipse.scout.rt.client.ui.form.AbstractForm.startInternal(AbstractForm.java:664) at org.eclipse.scout.rt.client.ui.basic.table.OrganizeColumnsForm.startModify(OrganizeColumnsForm.java:96) at org.eclipse.scout.rt.client.ui.basic.table.menus.OrganizeColumnsMenu.execAction(OrganizeColumnsMenu.java:37) at org.eclipse.scout.rt.client.ui.action.AbstractAction.doAction(AbstractAction.java:297) at org.eclipse.scout.rt.client.ui.action.AbstractAction$P_UIFacade.fireActionFromUI(AbstractAction.java:598) at org.eclipse.scout.rt.ui.rap.action.AbstractRwtMenuAction$1.run(AbstractRwtMenuAction.java:180) at org.eclipse.scout.rt.ui.rap.core.concurrency.RwtScoutSynchronizer$1.runVoid(RwtScoutSynchronizer.java:61) at org.eclipse.scout.rt.client.ClientJob.runStatus(ClientJob.java:177) at org.eclipse.scout.rt.client.ClientJob.runTransactionWrapper(ClientJob.java:161) at org.eclipse.scout.rt.client.ClientJob.run(ClientJob.java:149) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: java.lang.NullPointerException at org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField.getXMLFieldId(AbstractFormField.java:822) at org.eclipse.scout.rt.client.ui.form.fields.AbstractFormField.storeXML(AbstractFormField.java:828) at org.eclipse.scout.rt.client.ui.form.AbstractForm$13.visitField(AbstractForm.java:1841) at org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField.visitFields(AbstractCompositeField.java:184) at org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox.visitFields(AbstractListBox.java:886) at org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField.visitFields(AbstractCompositeField.java:192) at org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField.visitFields(AbstractCompositeField.java:192) at org.eclipse.scout.rt.client.ui.form.fields.AbstractCompositeField.visitFields(AbstractCompositeField.java:192) at org.eclipse.scout.rt.client.ui.form.AbstractForm.visitFields(AbstractForm.java:962) at org.eclipse.scout.rt.client.ui.form.AbstractForm.storeXML(AbstractForm.java:1851) at org.eclipse.scout.rt.client.ui.form.AbstractForm.storeXML(AbstractForm.java:1794) at org.eclipse.scout.rt.client.ui.form.AbstractForm.getXML(AbstractForm.java:1776)
Additional requirements came up. The actual issues reported in this bug are now tracked in bug #377781. Marking this ticket as duplicate. *** This bug has been marked as a duplicate of bug 377781 ***
bug closed