Setting the review author name by API
Oxygen general issues.
-
- Posts: 64
- Joined: Wed Dec 03, 2014 11:25 am
Setting the review author name by API
Hello,
Is-it possible to set the author name by API ?
I'm talking about the option in Oxygen Preferences / Editor / Edit Modes / Author / Review
And can we lazy expand this information at use by review panel and tooltips ?
Suppose that I set a user id and I want to show a user display name
Thanks
Is-it possible to set the author name by API ?
I'm talking about the option in Oxygen Preferences / Editor / Edit Modes / Author / Review
And can we lazy expand this information at use by review panel and tooltips ?
Suppose that I set a user id and I want to show a user display name
Thanks
-
- Posts: 64
- Joined: Wed Dec 03, 2014 11:25 am
Re: Setting the review author name by API
I just find a response to my first question with :
For the second point, I try without success :
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty(APIAccessibleOptionTags.CHANGE_TRACKING_AUTHOR, "00001");
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().getUtilAccess().addCustomEditorVariablesResolver(new EditorVariablesResolver() {
@Override
public String resolveEditorVariables(String contentWithEditorVariables, String currentEditedFileURL) {
if (contentWithEditorVariables.equals("${author.name}")) return "my display name";
return super.resolveEditorVariables(contentWithEditorVariables, currentEditedFileURL);
}
});
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Setting the review author name by API
Hi,
So:
https://www.oxygenxml.com/InstData/Edit ... oller.html
We have for example API to customize the tooltip shown when hovering a highlight:
ro.sync.ecss.extensions.api.AuthorReviewController.setReviewRenderer(PersistentHighlightRenderer)
or API to customize how things are displayed in the Review view:
ro.sync.ecss.extensions.api.review.ReviewsRenderingInformationProvider
and the same thing when presenting callout bubbles on the right side of the editing area:
ro.sync.ecss.extensions.api.callouts.CalloutsRenderingInformationProvider
Regards,
Radu
So:
We also have API available at opened XML file level:Is-it possible to set the author name by API ?
I'm talking about the option in Oxygen Preferences / Editor / Edit Modes / Author / Review
Code: Select all
authorAccess.getReviewController().setReviewerAuthorName(authorName);
I'm afraid we do not have a particular API for mapping the author name to a certain author display name, the author name is usually saved in the XML document and displayed as it is.And can we lazy expand this information at use by review panel and tooltips ?
Suppose that I set a user id and I want to show a user display name
We have for example API to customize the tooltip shown when hovering a highlight:
ro.sync.ecss.extensions.api.AuthorReviewController.setReviewRenderer(PersistentHighlightRenderer)
or API to customize how things are displayed in the Review view:
ro.sync.ecss.extensions.api.review.ReviewsRenderingInformationProvider
and the same thing when presenting callout bubbles on the right side of the editing area:
ro.sync.ecss.extensions.api.callouts.CalloutsRenderingInformationProvider
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 64
- Joined: Wed Dec 03, 2014 11:25 am
Re: Setting the review author name by API
Hi Radu,
Thanks a lot for your answer.
With given entry points to customize, I can modify user to display what I want in tooltip and review panel.
I'm encountering a problem registering a custom CalloutsRenderingInformationProvider in AuthorExtensionStateListener. It 's never used.
Can you give me more help for this point ?
Regards,
Vince
Thanks a lot for your answer.
With given entry points to customize, I can modify user to display what I want in tooltip and review panel.
I'm encountering a problem registering a custom CalloutsRenderingInformationProvider in AuthorExtensionStateListener. It 's never used.
Can you give me more help for this point ?
Code: Select all
AuthorReviewController reviewController = authorAccess.getReviewController();
reviewController.getAuthorCalloutsController().setCalloutsRenderingInformationProvider(new CalloutsRenderingInformationProvider() {
@Override
public AuthorCalloutRenderingInformation getCalloutRenderingInformation(AuthorPersistentHighlight highlight) {
return new AuthorCalloutRenderingInformation() {
@Override
public String getAuthor() {
return "author display name";
}
};
}
@Override
public boolean shouldRenderAsCallout(AuthorPersistentHighlight highlight) {
return true;
}
});
Vince
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Setting the review author name by API
Hi Vince,
I have not worked with the API for quite some time, so focusing on the callouts customization (those side bubbles), here's the code I wrote to test this in a plugin on my side:
Notice that "handlesAlsoDefaultHighlights" override I added to tell the API that I want to take control of everything (insertions/deletions/comments).
A highlight has a set of properties "ro.sync.ecss.extensions.api.highlights.AuthorPersistentHighlight.getClonedProperties()" and most of those callback methods can be answered by looking at the value for such a property.
Unfortunately the API does not allow you to just override the author name display computation. So you will need to re-implement all other methods, similar to how we implement them in our code, for example this method which returns the callout type uses some of our translated strings depending on the higlight type:
The "getColor()" method, I'm not sure how it could be implemented on your side so that it can be similar with ours though, it should be the same color as the highlight in the editor.
Regards,
Radu
I have not worked with the API for quite some time, so focusing on the callouts customization (those side bubbles), here's the code I wrote to test this in a plugin on my side:
Code: Select all
@Override
public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
pluginWorkspaceAccess.addEditorChangeListener(new WSEditorChangeListener() {
@Override
public void editorOpened(URL editorLocation) {
WSEditor editor = pluginWorkspaceAccess.getEditorAccess(editorLocation, StandalonePluginWorkspace.MAIN_EDITING_AREA);
WSEditorPage cp = editor.getCurrentPage();
if(cp instanceof WSAuthorEditorPage) {
WSAuthorEditorPage authorPage = (WSAuthorEditorPage) cp;
AuthorReviewController reviewController = authorPage.getAuthorAccess().getReviewController();
reviewController.getAuthorCalloutsController().setCalloutsRenderingInformationProvider(new CalloutsRenderingInformationProvider() {
@Override
public AuthorCalloutRenderingInformation getCalloutRenderingInformation(AuthorPersistentHighlight highlight) {
return new AuthorCalloutRenderingInformation() {
@Override
public String getAuthor() {
return "author display name";
}
@Override
public long getTimestamp() {
return 0;
}
@Override
public String getComment(int limit) {
return "Comment";
}
@Override
public String getContentFromTarget(int limit) {
return "CONTENT";
}
@Override
public Map<String, String> getAdditionalData() {
return null;
}
@Override
public String getCalloutType() {
return "CT";
}
@Override
public ro.sync.exml.view.graphics.Color getColor() {
return ro.sync.exml.view.graphics.Color.COLOR_RED;
}
};
}
@Override
public boolean shouldRenderAsCallout(AuthorPersistentHighlight highlight) {
return true;
}
/**
* @see ro.sync.ecss.extensions.api.callouts.CalloutsRenderingInformationProvider#handlesAlsoDefaultHighlights()
*/
@Override
public boolean handlesAlsoDefaultHighlights() {
return true;
}
});
}
};
}, StandalonePluginWorkspace.MAIN_EDITING_AREA);
}
A highlight has a set of properties "ro.sync.ecss.extensions.api.highlights.AuthorPersistentHighlight.getClonedProperties()" and most of those callback methods can be answered by looking at the value for such a property.
Unfortunately the API does not allow you to just override the author name display computation. So you will need to re-implement all other methods, similar to how we implement them in our code, for example this method which returns the callout type uses some of our translated strings depending on the higlight type:
Code: Select all
/**
* @see ro.sync.ecss.extensions.api.callouts.AuthorCalloutRenderingInformation#getCalloutType()
*/
@Override
public String getCalloutType() {
String typeStr = null;
PersistentHighlightType type = marker.getType();
switch (type) {
//Attribute changes.
case CHANGE_ATTRIBUTE_INSERTED:
typeStr = "@ " + messages.getString(Tags.INSERTED);
break;
case CHANGE_ATTRIBUTE_DELETED:
typeStr = "@ " + messages.getString(Tags.DELETED);
break;
case CHANGE_ATTRIBUTE_MODIFIED:
typeStr = "@ " + messages.getString(Tags.MODIFIED);
break;
case CHANGE_INSERT:
if(ChangeMarker.TYPE_SPLIT.equals(marker.getChangeSubType())) {
typeStr = messages.getString(Tags.SPLIT);
} else if(ChangeMarker.TYPE_SURROUND.equals(marker.getChangeSubType())) {
typeStr = messages.getString(Tags.SURROUNDED);
} else {
typeStr = messages.getString(Tags.INSERTED);
}
break;
case CHANGE_DELETE:
typeStr = messages.getString(Tags.DELETED);
break;
case COMMENT:
typeStr = messages.getString(Tags.COMMENTED);
break;
}
return typeStr;
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service