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 97720 - JsfJspDataObject.setModified(false) doesn't work
Summary: JsfJspDataObject.setModified(false) doesn't work
Status: VERIFIED WONTFIX
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Quy Nguyen
URL:
Keywords: T9Y
Depends on:
Blocks:
 
Reported: 2007-03-13 10:43 UTC by Jiri Skrivanek
Modified: 2007-05-25 10:52 UTC (History)
2 users (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 Jiri Skrivanek 2007-03-13 10:43:04 UTC
In our testing libraries we use DataObject.setModified(false) to discard changes
before closing editor. But it doesn't work with
org.netbeans.modules.visualweb.project.jsfloader.JsfJspDataObject. Page remains
modified in spite we call this method.

Build 200703011900, JDK1.5.0_10.
Comment 1 Marian Mirilovic 2007-03-14 08:37:02 UTC
This is stopper for automated tests for Web Designer. If we are not able to
close the file without saving the changes we did during the test we are not able
to start the test again.
Comment 2 Peter Zavadsky 2007-03-22 19:01:03 UTC
Passing to the owner.
Comment 3 Quy Nguyen 2007-03-22 23:49:04 UTC
Is there an available test case or some code that exhibits this problem?  Normal
usage in the IDE discards changes correctly.
Comment 4 Jiri Skrivanek 2007-03-23 10:35:46 UTC
Modify Page1.jsp location and assign the following code to a toolbar button or
menu item:
        String a = "D:\\WebApplication1\\web\\Page1.jsp";
        FileObject fo = FileUtil.toFileObject(new File(a));
        JsfJspDataObject dob = (JsfJspDataObject)JsfJspDataObject.find(fo);
        System.out.println("DOB="+dob);
        dob.setModified(false);

Modify the page (add a component from palette) and call the code. Nothing
happens and the page is still marked as modified.
Comment 5 Quy Nguyen 2007-03-27 08:34:46 UTC
The visual designer uses two different DataObjects in the editor (one for the
.java and one for the .jsp).  In order to discard all the changes, the
corresponding JsfJavaDataObject needs to be unmodified as well; use
org.netbeans.modules.visualweb.project.jsfloader.Util.findJavaForJsp(FileObject)
to find the right java file.
Comment 6 Jiri Skrivanek 2007-03-27 09:26:58 UTC
In our testing library we just call DataObject.setModified(false) and we don't
need to know what kind of DataObject it is. It works for example for
FormDataObject which is also MultiDataObject. So, I hope you can fix it.
Comment 7 Quy Nguyen 2007-03-27 22:46:20 UTC
The form designer works differently because it only modifies a single editable
file (the .form is not accessible from the IDE).  In our case, the .jsp and
.java files are independently modifiable, so calling
JsfJspDataObject.setModified(false) should not unmodify the .java file.
Comment 8 Jiri Skrivanek 2007-03-28 09:12:01 UTC
So, there is no real MultiDataObject but two separarate-like DataObjects which
know about each other. Then it is hard to implement 'close discard' action some
general way. It probably need to be hard-coded for JsfJsp/JsfJavaDataObject. But
there is another problem that Java view TopComponent doesn't activate node and
TopComponent.getActivatedNodes() returns an empty array. You can test it
manually, if you click to editor when Page1 is opened in Java view, the
Navigator is empty. If you click Page1.java node in Projects view, the Navigator
gets populated. And That's why we can't get DataObject from java editor
TopComponent.
Comment 9 Quy Nguyen 2007-03-28 18:44:41 UTC
The activated node switching for the java tab was fixed last week so it should
no longer be an issue.
Comment 10 Quy Nguyen 2007-04-25 22:07:15 UTC
Closing this, since the visualweb dataloader architecture will not be changed in
the near future and a workaround exists.
Comment 11 Jiri Skrivanek 2007-05-25 10:52:26 UTC
OK, verifying.