Styles.KEY_MIXED_CONTENT does not work with Oxygen Component

Post here questions and problems related to oXygen frameworks/document types.
CheryBen
Posts: 24
Joined: Tue Jun 05, 2012 10:34 am

Styles.KEY_MIXED_CONTENT does not work with Oxygen Component

Post by CheryBen »

Hi all, i have implemented a custom framework that provide a StylesFilter.

This filter works fine with Oxygen Author version, but i'm trying to switch my app to the Oxygen Component, and it seems that the Styles.KEY_MIXED_CONTENT property is not applied to my document.

Here is my code :

Code: Select all

    @Override
public Styles filter(Styles styles, AuthorNode authorNode) {
if (isImageNode(authorNode)) {
ro.sync.exml.view.graphics.Color red = ro.sync.exml.view.graphics.Color.COLOR_RED;
styles.setProperty(Styles.KEY_BACKGROUND_COLOR, red);
File test = new File("C:/test.jpg");
styles.setProperty(Styles.KEY_MIXED_CONTENT, getImageContent(test));
}

return styles;
}

private StaticContent[] getImageContent(File imageFile) {
return new StaticContent[] {new URIContent(imageFile.getParentFile().toURI().toString(), imageFile.getName())};
}
Result in Component version : my images nodes are in red but the image does not appear.
Result in Author version : my images nodes are in red and the images appear.

In debug mode, i don't see any difference in the property, do you have any idea? should i test anything else?
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Styles.KEY_MIXED_CONTENT does not work with Oxygen Component

Post by Radu »

Hi Benoit,

Well, if you add a System.err in custom the styles filter implementation, does it get called when running the Author Component?
Are you running the Author Component as an applet or embedded in another Java application?
Could you try to remove its local cache and try again? It is step (4) in the following procedure:

http://www.oxygenxml.com/doc/ug-oxygen/ ... oting.html

After you create your custom filter implementation, do you bundle it in a separate JAR file? Does your framework .framework file correctly reference this extra extension?
After this, do you pack the entire framework directory and copy it to the Author Component Project as a file called frameworks.zip.jar in the resources folder?

When running the component, does it report any problems? If the component is embedded as an applet, the Java Console should be enabled in order to show the messages.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9434
Joined: Fri Jul 09, 2004 5:18 pm

Re: Styles.KEY_MIXED_CONTENT does not work with Oxygen Component

Post by Radu »

One more idea:

Your posted code is just an example, right?
How exactly do you construct the absolute URL to the image? Do you use constructs like new File("relative/path/some.file")? Because such constructs depend on the folder in which the Java VM starts.
So maybe the base folder for the images is not properly computed when running the component.
Anyway, adding some logging in the filter implementation should help.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
CheryBen
Posts: 24
Joined: Tue Jun 05, 2012 10:34 am

Re: Styles.KEY_MIXED_CONTENT does not work with Oxygen Component

Post by CheryBen »

I'm using the component in a standalone application. As suggested in the other post, i send you the frameworks.zip.jar file.
Post Reply