Page 1 of 1

Styles.KEY_MIXED_CONTENT does not work with Oxygen Component

Posted: Mon Oct 15, 2012 6:35 pm
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?

Re: Styles.KEY_MIXED_CONTENT does not work with Oxygen Component

Posted: Tue Oct 16, 2012 11:51 am
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

Re: Styles.KEY_MIXED_CONTENT does not work with Oxygen Component

Posted: Tue Oct 16, 2012 11:54 am
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

Re: Styles.KEY_MIXED_CONTENT does not work with Oxygen Component

Posted: Tue Oct 16, 2012 3:18 pm
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.