Question about comment and change tracking mode

Having trouble installing Oxygen? Got a bug to report? Post it all here.
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Question about comment and change tracking mode

Post by alex911 »

Hello,

I need allow user to add comments only to a document. I integrated applet in my application and integration only comment actions: add comment, delete comment ...
To get document content I use reader:

AuthorComponentProvider.createReader().

But document content from this method does not have comments until user make any changes in a document. But I need allow user make only comments but not changing a document. The same behaviour I have when user make changes on "track changes" mode.

could you please help me with this problem.

Thank you in advance,
Alexander.
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,
But document content from this method does not have comments until user make any changes in a document. But I need allow user make only comments but not changing a document.


Let me see if I understand this:
So you set the XML content to the AuthorComponentProvider, then the user adds comments (without making changes).
Then you use the AuthorComponentProvider.createReader() and you do not obtain the comments as processing instructions in the XML content.
Is this correct?
I tested on my side and it worked for me. I used the method "ro.sync.ecss.samples.AuthorComponentSample.getSerializedDocument()" to get the content from the component after I made comments and the XML content contained the comment processing instructions.
Maybe you are not properly reading the content from the reader, could you give me some sample code?
The same behaviour I have when user make changes on "track changes" mode.
I do not quite understand. Is the user making changes with track changes ON but the XML content obtained from the component does not reflect the changes? This also works in my simple tests.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

code is:

public String getSerializedDocument () {
return AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run () {
StringBuilder builder = new StringBuilder();
BufferedReader reader = new BufferedReader(authorComponentProvider.createReader());
try {
char[] cb = new char[1024];
int r;
r = reader.read(cb);
while (r != -1) {
builder.append(cb, 0, r);
r = reader.read(cb);
}
} catch (Exception e) {
// Does not happen.
logger.error(e, e);
}
return builder.toString();
}
});
}
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

>>I do not quite understand. Is the user making changes with track changes ON but the XML content >>obtained from the component does not reflect the changes? This also works in my simple tests.

yes exactly, XML content obtained from the component does not reflect the changes
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

unfortunately is it not possible to get XML on your demo applet (http://www.oxygenxml.com/demo/AuthorDem ... -dita.html) to test behaviour.
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

The Java code you pasted is the code we ship with the AuthorComponentSample Java class and it should work, I tested using it too.
I need to know how your own code interacts with the component, are you sure you are reading the content from it after the user adds comments to the edited XML content?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu.

yes, we have save button in UI. We added comment and after that pressed save button.

save action is:

public void actionPerformed(ActionEvent event) {
String documentContent = authorComponent.getSerializedDocument();
authorComponent.saveContent(documentContent);
authorComponent.getJSobjectPrototype().call("save", new Object[] {authorComponent.getWidgetId(), documentContent, authorComponent.getEditorUID() });
}

getSerializedDocument: I posted it already.

saveContent is:

public void saveContent(String content) {
this.oldContent = content;
}


>>are you sure you are reading the content from it after the user ...
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

You could try to activate the Java console (you probably did this already).
And after you get the content from the document:

Code: Select all

String documentContent = authorComponent.getSerializedDocument();
add a System.err.println(documentContent);.

You should see the content in the Java console. Does the printed content contain the comments there?
If so, then there is a problem in the Javascript code which sends the new content to the server and overwrites the original resource there.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,

Thank you very much for your help, we have found a bag. This is our local error.

Regards,
Alexander
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,
I want to ask one more question.I added a button "save" and it works when you change a document is text, but when I add comment, button save don't enable.

Regards,
Alexander
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

How exactly do you enable the "Save" button? Did you add an AuthorDocumentListener which enables it? An AuthorDocumentListener does not receive events when a comment is added.
You should also add a persistent highlight listener:

AuthorDocumentController.addAuthorPersistentHighlightListener(AuthorPersistentHighlightsListener)


Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,

Thank you very much for your help, your advice helped me a lot.

Regards,
Alexander
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,

I have one more question. In the search dialog is a property of XPath
(field + button options). Can they be removed from the dialogue?


Regards,
Alexander
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

In earlier versions of the Author Component libraries the Find/Replace dialog had the XPath filter removed but then we received feedback from another customer who wanted it to be visible so we made it visible.
We'll try to add some setting for this in the next component version.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,

Thanks for the information.

Regards,
Alexander
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,

After you insert the link into the body of the topic after
pressing the Enter link duplicated

1. create topic
2. checkout
3. Place the cursor after the text Topic paragraph
4. Enter -> Split p
5. web link (Browse for reference to a Web resource)
6. Paste the link, click OK
7. Enter -> Split p

Regards,
Alexander
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

If I understand correctly I think that after step (6), after the link is inserted, the caret position is inside the empty <xref> (and not after it). So splitting the <p> also splits the empty xref, adding one in the next <p>, this is how the behavior has always been.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,

I have a question for you. I load the document, do the action there and there and there is an error message is displayed. Then I need to return the original document type and I use refreshXmlContent. Loading document in its original form, but at the bottom of the error message is written.

Regards,
Alexander
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,
and I use refreshXmlContent...
What exactly does your refresh method do, what API does it call on our side? Maybe you can paste some sample code.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,
authorComponentProvider.getWSEditorAccess().reloadContent(new StringReader(xmlContent), clearChangeHistory);

it does not update the status of errors, but they are no

Regards,
Alexander
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

You are right and we'll fix this in the next version of the component (15.0) in a couple of months.
In the meantime you can use something like:

Code: Select all

authorComponentProvider.load(authorComponentProvider.getWSEditorAccess().getEditorLocation(), new StringReader("YOUR CONTENT HERE"));
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,

Thank you. this solves the problem.

Regards,
Alexander
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,
I add the attribute as follows: authorAccess.getDocumentController().setAttribute("conref",attrValue,element);.
But he did not appear, although the xml they are. If the xml to make any changes, the oxygen will see attribute.

Regards,
Alexander
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

So after you used the API and passed to the Text page, the XML contained the attribute.
Where exactly did it not appear? In the Attributes view?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

Hi Radu,

After adding "conref" at any node: authorAccess.getDocumentController (). SetAttribute ("conref", attrValue, element.
This link is added to the Attributes view and xml, but the editor does not change anything. When we reload the document on the node to which we added the attribute "conref" link appears. How to display it immediately when you add?

Regards,
Alexander
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

So the edited XML content is DITA, right?
Did you make any changes to the DITA document type bundled with the component?

Here's what I tested:

I created and added to the component's toolbar an action like:

Code: Select all

actionsToolbar.add(new ToolBarButton(new AbstractAction("CONREF") {

public void actionPerformed(ActionEvent arg0) {
try {
AuthorElement elem = (AuthorElement) authorPage.getDocumentController().getNodeAtOffset(authorPage.getCaretOffset());
authorPage.getDocumentController().setAttribute("conref", new AttrValue("springFlowers.xml#conceptId/sf"), elem);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
}));
Then I opened in the component the content of a topic from the same folder with springFlowers.xml, created a new paragraph, placed the caret inside the paragraph and invoked my action. The action added the "conref" attribute value to the element + the paragraph changed to display the content of the target paragraph, so the changes reflected also in the Author mode.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

hi,Radu.
I would like to ask a question. I'm having problems with the update 2.14. I replaced all the libraries and other files in your applet with the new update. I pass build and begins loading of the applet, but it is not loaded.
Log: http://rghost.ru/45657151
tell me what could be the reason.
Regards,
Alexander
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

I did not find anything unusual in the log files.
The class loader seems to load all classes.
In what stage exactly does not applet block? Does the undetermined progress bar show up?

Possible problems:
1) Maybe the applet shows a license registration dialog which somehow falls behind the main browser window.

2) Maybe the component is blocked in a remote operation (opening via HTTP some kind of resource for which proxy data or the authentication has not been set).

If you still cannot get to the bottom of this, in the applet's class before initializing the component (on the ro.sync.ecss.samples.AuthorComponentSampleApplet.startAppletInit() method) you could set the logger to full debug:

Code: Select all

org.apache.log4j.Logger.getRootLogger().setLevel(Level.ALL);
After this, the Java console should have a lot more information from what's going on internally in our code. The loading will also be slowed down by the amount of logging. There is an option in the Java Control Panel called "Enable logging" which also saves the Java console to disk. Then you can pack it and send it to us.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alex911
Posts: 19
Joined: Tue Jan 29, 2013 10:26 am

Re: Question about comment and change tracking mode

Post by alex911 »

hi,Radu.
applet is blocked at the stage of initialization. progress bar show up
here is the log file "http://rghost.ru/45659958"
Regards,
Alexander
Radu
Posts: 9071
Joined: Fri Jul 09, 2004 5:18 pm

Re: Question about comment and change tracking mode

Post by Radu »

Hi Alexander,

I do not see additional details in the logging file.
Did you add the

Code: Select all

org.apache.log4j.Logger.getRootLogger().setLevel(Level.ALL);
as the first line on the overwritten javax.swing.JApplet.init() method?
If so, in the Java console view you should get a lot of verbose DEBUG logging coming from our code. Is there more verbose logging in the Java console view?
The Author Component Sample Project had an ro.sync.ecss.samples.AuthorComponentSampleApplet.initLogger() method which did about the same thing.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply