This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 88215 - no propertychangeevent for attributes when merging
Summary: no propertychangeevent for attributes when merging
Status: RESOLVED WONTFIX
Alias: None
Product: ide
Classification: Unclassified
Component: Schema2Beans (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: schema2beans-issues@ide
URL: http://maxnitribitt.blog-city.com
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-30 10:57 UTC by maxnitribitt
Modified: 2011-09-13 14:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description maxnitribitt 2006-10-30 10:57:55 UTC
there seems to be a bug in the merge function of the schema2beans.jar on this site:

http://schema2beans.netbeans.org/files/documents/117/538/schema2beans-4.2.0.zip

when I'm merging two graphs with the mergeUpdate method, I do not receive any
PropertyChangeEvents when Attributes are changing.

Steps to reproduce:

generate binding classes with GenBeans for the jasperreports dtd:

http://jasperreports.sourceforge.net/dtds/jasperreport.dtd

create two report files that differ in one attribute:
8<--------------file1.jrxml--------------->8
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport bottomMargin="30" columnWidth="555" isFloatColumnFooter="true"
leftMargin="20" name="TableReport" pageHeight="842" pageWidth="595"
rightMargin="20" topMargin="30">
 <style fontName="Arial" fontSize="10" isBold="false" isDefault="true"
isItalic="false" isPdfEmbedded="false" isStrikeThrough="false"
isUnderline="false" name="Arial" pdfEncoding="Cp1252" pdfFontName="Helvetica"/>
 <background>
   <band height="17" isSplitAllowed="true">
       </band>
 </background>
 <title>
   <band height="47" isSplitAllowed="true">
   </band>
   <!-- do not change this comment-->
 </title>
 <pageHeader>
   <band height="109">
   </band>
 </pageHeader>
 <detail>
   <band height="128">
   </band>
 </detail>
 <columnFooter>
   <band height="67">
   </band>
 </columnFooter>
</jasperReport>
8<--------------file2.jrxml--------------->8
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport bottomMargin="30" columnWidth="555" isFloatColumnFooter="true"
leftMargin="20" name="TableReport" pageHeight="842" pageWidth="595"
rightMargin="20" topMargin="30">
 <style fontName="Arial" fontSize="10" isBold="false" isDefault="true"
isItalic="false" isPdfEmbedded="false" isStrikeThrough="false"
isUnderline="false" name="Arial" pdfEncoding="Cp1252" pdfFontName="Helvetica"/>
 <background>
   <band height="18" isSplitAllowed="true">
       </band>
 </background>
 <title>
   <band height="47" isSplitAllowed="true">
   </band>
   <!-- do not change this comment-->
 </title>
 <pageHeader>
   <band height="109">
   </band>
 </pageHeader>
 <detail>
   <band height="128">
   </band>
 </detail>
 <columnFooter>
   <band height="67">
   </band>
 </columnFooter>
</jasperReport>
8<----------------------------->8
write a test class:
JasperReport report = JasperReport.createGraph(new File("file1.xml"));
final PropertyChangeListener listen = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent evt) {
            System.out.println("event "+evt.getPropertyName());
      }
};
jasperReport.addPropertyChangeListener(listen);
JasperReport report2 = JasperReport.createGraph(new File("file2.xml"));
report.merge(report2,BaseBean.MERGE_UPDATE);

-----------------------------
expected behaviour:

event /JasperReport/Title/Band:Height

-----------------------------
observed behaviour:


-----------------------------

I only receive events when Elements are updated.
Comment 1 maxnitribitt 2006-10-30 11:23:01 UTC
The same is true for the schema2beans module in netbeans 5.5
Comment 2 maxnitribitt 2006-11-22 18:14:51 UTC
I made some tests with the library and found out, that the Attributes are set,
but there is no PropertyChangeEvent. In BaseBean's mergeTree method there is a
check for differences via BeanComparators (isArray is false). If a Difference is
found, newValue is set, but apparently never used:

 if (o3 != o1){
          newValue = (c==0)?o3:newValue;
 }

 It seems that the attributes, although they are stated in the dtd and part of
the generated classes are silently set via
Schema2BeansUtil.mergeUnsupportedElements instead. 

When I change the mergeTree method to merge the Attributes when differences are
found I get the behaviour I expected:

if (o3 != o1){
      newValue = (c==0)?o3:newValue;
      if (!hasKey &&
cmp.hasKeyDefined(prop))((BaseBean)o1).mergeAttributes((BaseBean) newValue, mode); 
}

For me this bug is a showstopper, because I'm using classes generated by
schema2beans as a datamodel for a multiview editor. My jasperreports module
relies on propertychangeevents to synchronize the visual editor with the xml view.
Comment 3 Petr Jiricka 2006-12-20 17:45:06 UTC
Marking as a duplicate then.

*** This issue has been marked as a duplicate of 88200 ***
Comment 4 maxnitribitt 2007-04-17 10:35:32 UTC
This bug is NOT a duplicate of #88200. To explain this misconception: I had
submitted two bug independent bug reports to the mailing list, because I didn't
know how to add it here by then. emononen has added one of these bugs as #88200.
The other -independent- bug was added by me here. 

I mentioned this as a comment on 88200, to thank erno for filing the bug and
pjiricka seems to have misinterpreted this and has marked this as a duplicate of
#88200. Sorry for the confusion :) ,
Toni
Comment 5 Erno Mononen 2007-06-21 15:12:21 UTC
Should be fixed for 6.0, so setting the TM accordingly.
Comment 6 Erno Mononen 2008-02-04 16:32:00 UTC
Needs to be re-evaluated.
Comment 7 Marian Mirilovic 2009-02-20 18:08:29 UTC
update no67 keyword
Comment 8 Petr Jiricka 2011-09-13 14:27:55 UTC
As this bug does not affect the NetBeans IDE and the Oracle NetBeans team is not planning to address it, I am closing this as WONTFIX. Anyone who would like to take this on and contribute the solution, please reopen and reassign to yourself.