ExtensionsBundle Implementation
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 124
- Joined: Tue May 29, 2012 5:42 pm
ExtensionsBundle Implementation
Post by sebastienlavandier »
Hi,
I need to implement a StyleFilter which must used an AuthorAccess. So, for do that I implemented an CustomExtensionsBundle which extend ExtensionsBundle.
This CustomExtensionsBundle instantiate a CustomStylesFilter (which implements StylesFilter) and an AuthorExtensionStateListener (which implements AuthorExtensionStateListener, AuthorAccessProvider).
The Only one reference about this CustomExtensionsBundle is in my .framework file.
But the CustomExtensionBundle is instanciate twice, and I don't understand why.
Do you have an idea about it ?
Thanks in advance for your answer.
Sébastien
I need to implement a StyleFilter which must used an AuthorAccess. So, for do that I implemented an CustomExtensionsBundle which extend ExtensionsBundle.
Code: Select all
public class CustomExtensionBundle extends ExtensionsBundle {
private CustomAuthorExtensionStateListener extensionStateListener = new CustomAuthorExtensionStateListener ();
@Override
public String getDocumentTypeID() {
return "Document type ID";
}
@Override
public String getDescription() {
return "Description";
}
@Override
public ro.sync.exml.editor.xmleditor.pageauthor.AuthorDnDListener createAuthorAWTDndListener() {
return new DragNDropListener();
}
@Override
public StylesFilter createAuthorStylesFilter() {
return new CustomStylesFilter(extensionStateListener);
}
@Override
public AuthorExtensionStateListener createAuthorExtensionStateListener() {
return extensionStateListener;
}
}
The Only one reference about this CustomExtensionsBundle is in my .framework file.
Code: Select all
<field name="extensionsBundleClassName">
<String>com.miyCompany.extensionBundle.CustomExtensionBundle</String></field>
Do you have an idea about it ?
Thanks in advance for your answer.
Sébastien
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: ExtensionsBundle Implementation
Post by alex_jitianu »
Hi Sebastien,
We are aware that the ExtensionsBundle gets instantiated twice on document load and we already have added an issue to fix it. We also have an issue registered to provide the StylesFilter with an AuthorAccess instance. Meanwhile, if you want an AuthorAccess instance in the StylesFilter you can get one like this:
Best regards,
Alex
We are aware that the ExtensionsBundle gets instantiated twice on document load and we already have added an issue to fix it. We also have an issue registered to provide the StylesFilter with an AuthorAccess instance. Meanwhile, if you want an AuthorAccess instance in the StylesFilter you can get one like this:
Code: Select all
WSEditor editorAccess =
PluginWorkspaceProvider.getPluginWorkspace().getCurrentEditorAccess(PluginWorkspace.MAIN_EDITING_AREA);
if (editorAccess != null) {
WSEditorPage currentPage = editorAccess.getCurrentPage();
if (currentPage instanceof WSAuthorEditorPage) {
AuthorAccess authorAccess = ((WSAuthorEditorPage) currentPage).getAuthorAccess();
}
}
Alex
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: ExtensionsBundle Implementation
Post by alex_jitianu »
Hi Sebastien,
I'm just curious, why you need an AuthorAccess object in a StylesFilter? What's the use case?
Best regards,
Alex
I'm just curious, why you need an AuthorAccess object in a StylesFilter? What's the use case?
Best regards,
Alex
-
- Posts: 124
- Joined: Tue May 29, 2012 5:42 pm
Re: ExtensionsBundle Implementation
Post by sebastienlavandier »
Hi,
We work with CGM/TIFF illustrations format files in our xml documents, so we need to convert this to SVG format.
When our CustomStyleFilter found an illustration element node Ex:<GRAPHIC>, it must access to the DOCTYPE to find the illustration's filename. And for read the Doctype, we must used : authorAccess.getDocumentController().getDoctype();
With the fileName, we can convert the CGM, or TIF file to SVG.
Do you have a solution without AuhtorAcces ?
Thanks in advance.
Sébastien
We work with CGM/TIFF illustrations format files in our xml documents, so we need to convert this to SVG format.
When our CustomStyleFilter found an illustration element node Ex:<GRAPHIC>, it must access to the DOCTYPE to find the illustration's filename. And for read the Doctype, we must used : authorAccess.getDocumentController().getDoctype();
With the fileName, we can convert the CGM, or TIF file to SVG.
Do you have a solution without AuhtorAcces ?
Thanks in advance.
Sébastien
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: ExtensionsBundle Implementation
Hi Sébastien,
How exactly does the graphic refer the image? If you are using unparsed entity references you could use the API
Regards,
Radu
How exactly does the graphic refer the image? If you are using unparsed entity references you could use the API
Code: Select all
ro.sync.ecss.extensions.api.AuthorDocumentController.getUnparsedEntityUri(AuthorNode, String)
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 124
- Joined: Tue May 29, 2012 5:42 pm
Re: ExtensionsBundle Implementation
Post by sebastienlavandier »
Hi,
Unfortunately in the Style Filter, we have only Styles and AuthorNode.
To use the AuthorDocumentController, we need the AuthorAccess too.
Sébastien
Unfortunately in the Style Filter, we have only Styles and AuthorNode
Code: Select all
public Styles filter(Styles styles, AuthorNode authorNode)
To use the AuthorDocumentController, we need the AuthorAccess too.
Sébastien
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: ExtensionsBundle Implementation
Hi Sébastien,
I understand, we'll see how we can improve the StylesFilter API in a future version. In the meantime you can use Alex's workaround code.
Regards,
Radu
I understand, we'll see how we can improve the StylesFilter API in a future version. In the meantime you can use Alex's workaround code.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: ExtensionsBundle Implementation
By the way, if you just want to show an image referenced via an unparsed entity you can also do this via the CSS:
http://www.oxygenxml.com/doc/ug-oxygen/ ... ction.html
Regards,
Radu
http://www.oxygenxml.com/doc/ug-oxygen/ ... ction.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 124
- Joined: Tue May 29, 2012 5:42 pm
Re: ExtensionsBundle Implementation
Post by sebastienlavandier »
Hi,
We already use oxy_unparsed-entity-uri for all supported image file extension by Oxygen. But for the CGM files we don't have solution if we can't use the styleFilter with AuthorAcces.
We are waiting the next version ...
have a nice day.
Sébastien.
We already use oxy_unparsed-entity-uri for all supported image file extension by Oxygen. But for the CGM files we don't have solution if we can't use the styleFilter with AuthorAcces.
We are waiting the next version ...
have a nice day.
Sébastien.
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: ExtensionsBundle Implementation
Hi Sébastien,
It's important when asking advice to give more details about the use case, maybe your specific problem can be solved not necessarily using a certain API but by taking a different approach.
I thing you have several other choices, haven't tested them thoroughly but they might work.
Let's say that the CSS is something like:
First approach:
In the StylesFilter implementation you received a pre-computed Styles object which on the method Styles.getMixedContent() will return an array containing an ro.sync.ecss.css.URIContent pointing to the CGM image. The URIContent.getCatalogExpandedURL() already has the reference to the CGM properly computed going through the unparsed URI mappings. So you could take this URL and create another URIContent object by changing the extension to point to an SVG image instead.
Second approach:
Without any StylesFilter, Oxygen uses the usual Swing libraries to load images, and you can implement a Swing "ImageIO" plugin for CGM images. This plugin would be packed in a JAR which would need to be in the component's class path.
Third approach:
In the CSS you could have something like:
By the way, do you use an open source converter for CGM to SVG? We are interested in having better CGM support in Oxygen. Do you know any details about how the XML referencing CGM gets published? If it gets published to HTML does the CGM support need to have an ActiveX control installed in IE in order to show the CGM properly?
Regards,
Radu
It's important when asking advice to give more details about the use case, maybe your specific problem can be solved not necessarily using a certain API but by taking a different approach.
I thing you have several other choices, haven't tested them thoroughly but they might work.
Let's say that the CSS is something like:
Code: Select all
imagedata[entityref]{
content: oxy_url(oxy_unparsed-entity-uri(attr(entityref)));
}
In the StylesFilter implementation you received a pre-computed Styles object which on the method Styles.getMixedContent() will return an array containing an ro.sync.ecss.css.URIContent pointing to the CGM image. The URIContent.getCatalogExpandedURL() already has the reference to the CGM properly computed going through the unparsed URI mappings. So you could take this URL and create another URIContent object by changing the extension to point to an SVG image instead.
Second approach:
Without any StylesFilter, Oxygen uses the usual Swing libraries to load images, and you can implement a Swing "ImageIO" plugin for CGM images. This plugin would be packed in a JAR which would need to be in the component's class path.
Third approach:
In the CSS you could have something like:
Code: Select all
imagedata[entityref]{
content: oxy_url(oxy_replace(oxy_unparsed-entity-uri(attr(entityref)), '.cgm', '.svg'));
}
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