Refresh KeyDefinitionInfo values
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Refresh KeyDefinitionInfo values
Post by Konstantin »
Hello
We use Webapp 18.0.0.6
In our application we use different reuse elements like this:
In one moment value of this Keyword is changed and I need refresh it in editor.
I use KeyDefinitionManager and fill KeyDefinitionInfo for this editor with.
Then I need refresh editor to change values.
For this I use JS:
but it does not help. I must get request on Servlet to take content for this reuse elements but it does not happen.
How can I update "keyref" or "conkeyref" in editor ?
We use Webapp 18.0.0.6
In our application we use different reuse elements like this:
Code: Select all
<ph keyref="keyword_q"/>
I use KeyDefinitionManager and fill KeyDefinitionInfo for this editor with.
Code: Select all
public class WorkspacePluginExtension implements WorkspaceAccessPluginExtension {
private static WebappKeyDefinitionManager keyManager = new WebappKeyDefinitionManager();
@Override
public void applicationStarted(final StandalonePluginWorkspace workspace) {
final WebappPluginWorkspace webappWorcspace = (WebappPluginWorkspace) workspace;
webappWorcspace.setDITAKeyDefinitionManager(keyManager);
..........
Code: Select all
public class WebappKeyDefinitionManager extends KeyDefinitionManager {
....
private void fillKeys(final URL url, final List<KeyDefinitionElement> list) {
final String editorUID = Utils.getEditorUID(url.toString());
List<KeyDefinitionInfo> keyDefinitions = keysMap.get(editorUID);
if (keyDefinitions == null) {
keyDefinitions = new ArrayList<>();
keysMap.put(editorUID, keyDefinitions);
} else {
keyDefinitions.clear();
}
for (final KeyDefinitionElement element : list) {
final KeyDefinitionInfo info = new KeyDefinitionInfo();
final String query = url.getQuery();
final StringBuilder dwUrl = new StringBuilder();
...
final URL correct = CorrectURLUtil.correct(new URL(dwUrl.toString()));
info.setProperty(KeyDefinitionInfo.DEFINITION_LOCATION, correct);
info.setProperty(KeyDefinitionInfo.NAME, element.getName());
info.setProperty(KeyDefinitionInfo.HREF, element.getLocation());
....
keyDefinitions.add(info);
}
}
For this I use JS:
Code: Select all
editor.restoreContent();
but it does not help. I must get request on Servlet to take content for this reuse elements but it does not happen.
How can I update "keyref" or "conkeyref" in editor ?
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Re: Refresh KeyDefinitionInfo values
Post by Konstantin »
I found this answer and it works:
topic10642.html#p30978
But it was for Applet low than 16 version
Maybe there is better way to do it ?
topic10642.html#p30978
Code: Select all
AuthorActionsProvider actionsProvider = authorAccess.getEditorAccess().getActionsProvider();
Map<String, Object> authorCommonActions = actionsProvider.getAuthorCommonActions();
Object refreshRefAction = authorCommonActions.get("Author/Refresh_references");
actionsProvider.invokeAction(refreshRefAction);
Maybe there is better way to do it ?
-
- Site Admin
- Posts: 95
- Joined: Thu Jun 09, 2016 2:01 pm
Re: Refresh KeyDefinitionInfo values
Post by Gabriel Titerlea »
Hello,Maybe there is better way to do it ?
Calling:
Code: Select all
AuthorActionsProvider actionsProvider = authorAccess.getEditorAccess().getActionsProvider();
Map<String, Object> authorCommonActions = actionsProvider.getAuthorCommonActions();
Object refreshRefAction = authorCommonActions.get("Author/Refresh_references");
actionsProvider.invokeAction(refreshRefAction);
There is no better way.
Best,
Gabriel
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
-
- Posts: 32
- Joined: Tue May 26, 2015 10:28 am
Re: Refresh KeyDefinitionInfo values
Post by aleh.haidash »
Hello.
Using this way for refreshing content I set dirty status to TRUE and activate Redo button. It's not well for me. How can I refresh references without setting status dirty? or maybe can I change dirty to FALSE after that operation?
Thanks.
Code: Select all
AuthorActionsProvider actionsProvider = authorAccess.getEditorAccess().getActionsProvider();
Map<String, Object> authorCommonActions = actionsProvider.getAuthorCommonActions();
Object refreshRefAction = authorCommonActions.get("Author/Refresh_references");
actionsProvider.invokeAction(refreshRefAction);
Thanks.
Best Regards,
Aleh
Aleh
-
- Site Admin
- Posts: 95
- Joined: Thu Jun 09, 2016 2:01 pm
Re: Refresh KeyDefinitionInfo values
Post by Gabriel Titerlea »
Hello,aleh.haidash wrote:How can I refresh references without setting status dirty? or maybe can I change dirty to FALSE after that operation?
What version of Web Author are you using? How is a user initiating the call to the refresh references action? I was not able to reproduce the bug where the Redo button is activated after calling the refresh actions method.
Regarding the dirty status, assuming you have defined an author operation which refreshes actions:
Code: Select all
package com.example;
public class RefreshReferences implements AuthorOperation {
@Override
public String getDescription() {
return "Description";
}
@Override
public void doOperation(AuthorAccess authorAccess, ArgumentsMap arg1)
throws IllegalArgumentException, AuthorOperationException {
AuthorActionsProvider actionsProvider = authorAccess.getEditorAccess().getActionsProvider();
Map<String, Object> authorCommonActions = actionsProvider.getAuthorCommonActions();
Object refreshRefAction = authorCommonActions.get("Author/Refresh_references");
actionsProvider.invokeAction(refreshRefAction);
}
@Override
public ArgumentDescriptor[] getArguments() {
return null;
}
}
Code: Select all
JavascriptRefreshAction.prototype.actionPerformed = function(callback) {
var wasDirty = this.editor.isDirty();
this.editor.getActionsManager().invokeOperation(
'com.example.RefreshReferences', {},
function () {
this.editor.setDirty(wasDirty);
callback();
}.bind(this));
};
Best,
Gabriel
-
- Posts: 32
- Joined: Tue May 26, 2015 10:28 am
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