On 07/25/2011 10:16 PM, Fabián Mandelbaum wrote: > Hello Hussein, > > it worked like a charm. Thanks a lot.
You're welcome. I made a little mistake in my snippet. Please remove the "break;" from the "for (DocumentListener docListener : docListeners)" loop below. This way, you'll rebuild *all* the views of the document and not just the first one. > > 2011/7/25 Hussein Shafie<[email protected]>: >> On 07/24/2011 06:42 PM, Fabián Mandelbaum wrote: >>> >>> Hello Hussein, thanks again for your ideas. It's still not working >>> though. I've changed the 'algorithm' and am now marking the whole >>> document read-only, and a certain list of elements as read-write (to >>> achieve the "read-write islands in a read-only ocean" concept). >> >> I've managed to reproduce the problem. Choosing "read-write islands in a >> read-only ocean" rather than "read-write document with some read-only >> elements" cannot solve your problem. See below. >> >> >> XXE's CSS engine does not automatically react to property changes like it >> automatically reacts to attribute and/or child element changes. You need to >> explicitly invoke DocumentView.rebuildView after you change a ``visual'' >> property of a node (I mean, which like property readOnly is rendered in the >> CSS). >> >> If you add this snippet at the end of your checkingDocument(), this should >> solve your problem: >> >> --- >> import com.xmlmind.xml.doc.DocumentListener; >> import com.xmlmind.xmledit.view.DocumentView; >> >> @Override >> public void checkingDocument(Document doc, Reason reason, >> URL saveAsURL) { >> if (Reason.OPEN.equals(reason)) { >> ... >> doc.endEdit(); >> >> DocumentListener[] docListeners = >> doc.getDocumentListeners(true); >> for (DocumentListener docListener : docListeners) { >> if (docListener instanceof DocumentView) { >> ((DocumentView) docListener).rebuildView(doc); >> brseak; >> } >> } >> } >> } >> --- >> >> Reference: >> >> * >> http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/doc/Document.html#getDocumentListeners(boolean) >> >> * >> http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmledit/view/DocumentView.html#rebuildView(com.xmlmind.xml.doc.Node) >> >> -- XMLmind XML Editor Support List [email protected] http://www.xmlmind.com/mailman/listinfo/xmleditor-support

