Dynamically set action parameters
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 24
- Joined: Tue Jun 05, 2012 10:34 am
Dynamically set action parameters
Hi, once again i have a question about how to use oxygen author API. The API is so great that i'd like to do amazing things and don't know if it's really possible 
I would like to drop an object in the author page, intercept this object in an AuthorDnDListener, find the appropriate custom action, inject parameters depending on the droped object and then invoke the action to insert xml fragment filled with the good datas.
The only one point that i miss is the action's parameters settings.
I can find an action by calling editorAccess.getActionsProvider().getAuthorExtensionActions().get("drop.myObject").
I can't change parameters here, so i tried to change them directly in the action.
I extended the InsertFragmentOperation to fill the configured fragment with the droped object datas.
Here i can retreive the fragment by calling argumentsMap.getArgumentValue("fragment"), then i can fill it with datas. But i'd like to reinject the new fragment in the argumentsMap to call super.doOperation(authorAccess, argumentsMap).
It seems that the arguments has several methods but no setter available. May be there is one but it's obfuscated (i think this is a setter cause of the parameters).
Is there another way to inject parameters in actions? or would it be possible let a clear access to the setter in a future version of Oxygen?
Thanks for all,
Benoit Chery.
4DConcept - France

I would like to drop an object in the author page, intercept this object in an AuthorDnDListener, find the appropriate custom action, inject parameters depending on the droped object and then invoke the action to insert xml fragment filled with the good datas.
The only one point that i miss is the action's parameters settings.
I can find an action by calling editorAccess.getActionsProvider().getAuthorExtensionActions().get("drop.myObject").
I can't change parameters here, so i tried to change them directly in the action.
I extended the InsertFragmentOperation to fill the configured fragment with the droped object datas.
Here i can retreive the fragment by calling argumentsMap.getArgumentValue("fragment"), then i can fill it with datas. But i'd like to reinject the new fragment in the argumentsMap to call super.doOperation(authorAccess, argumentsMap).
It seems that the arguments has several methods but no setter available. May be there is one but it's obfuscated (i think this is a setter cause of the parameters).
Is there another way to inject parameters in actions? or would it be possible let a clear access to the setter in a future version of Oxygen?
Thanks for all,
Benoit Chery.
4DConcept - France
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Dynamically set action parameters
Hi Benoit,
The API getAuthorExtensionActions() gives access to swing actions, each one wrapping an Author action. An Author Action is not completely equivalent to an Author Operation, an action can have multiple operations which are activated when certain XPath conditions are fulfilled. The purpose of this API is for the user to be able to invoke these actions without any possibility of controlling parameters. For example the user can from the API to force the document to open in "Full Tags" display by calling a certain action when the document opens. Or he can show the content completion window by calling from the API the action which starts the content completion.
But you have workarounds, either create some static utility methods from your operation's code which can be used both from the operation or from the DnD handler.
Or from the Dnd handler instantiate the author operation and call its doOperation method directly passing it the AuthorAccess and an anonymous implementation of an Arguments map.
Regards,
Radu
The API getAuthorExtensionActions() gives access to swing actions, each one wrapping an Author action. An Author Action is not completely equivalent to an Author Operation, an action can have multiple operations which are activated when certain XPath conditions are fulfilled. The purpose of this API is for the user to be able to invoke these actions without any possibility of controlling parameters. For example the user can from the API to force the document to open in "Full Tags" display by calling a certain action when the document opens. Or he can show the content completion window by calling from the API the action which starts the content completion.
But you have workarounds, either create some static utility methods from your operation's code which can be used both from the operation or from the DnD handler.
Or from the Dnd handler instantiate the author operation and call its doOperation method directly passing it the AuthorAccess and an anonymous implementation of an Arguments map.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 24
- Joined: Tue Jun 05, 2012 10:34 am
Re: Dynamically set action parameters
The last solution worked fine, i can now fill all my fragments with the droped objects.
But i have now a new problem, my fragments in .framework file are like :
<figure id="${id}"><title>${title}</title></figure>
I implemented a solution that replace the ${} by the bean properties. The problem is that Oxygen already have such mechanism and replace ${id} by a unique identifier.
Is there a way to escape ${id} string from oxygen replacement?
But i have now a new problem, my fragments in .framework file are like :
<figure id="${id}"><title>${title}</title></figure>
I implemented a solution that replace the ${} by the bean properties. The problem is that Oxygen already have such mechanism and replace ${id} by a unique identifier.
Is there a way to escape ${id} string from oxygen replacement?
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Dynamically set action parameters
Hi Benoit,
If an operation's parameters contain editor variables which are known by Oxygen (full list here: http://www.oxygenxml.com/doc/ug-oxygen/ ... ables.html) , then Oxygen replaces them before your code gets invoked (and your code gets the parameter with the known editor variables already expanded).
The only workaround I see is to use an editor variable name which is not known by Oxygen and thus you have the possibility to expand it yourself in your Java code.
Regards,
Radu
If an operation's parameters contain editor variables which are known by Oxygen (full list here: http://www.oxygenxml.com/doc/ug-oxygen/ ... ables.html) , then Oxygen replaces them before your code gets invoked (and your code gets the parameter with the known editor variables already expanded).
The only workaround I see is to use an editor variable name which is not known by Oxygen and thus you have the possibility to expand it yourself in your Java code.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
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